Can C++ install an event handler for CRhinoMeshObject on object changed?


(Gccdragoonkain) #1

This is a long shot, but I’d like to be able to land in a callback whenever the user manipulates a previously selected CRhinoBrepObject (i.e. by pulling one of its points, faces, edges, etc)?

Is that possible?


(Gccdragoonkain) #2

bpeooooo

class CControlCageEditedEventWatcher : public CRhinoEventWatcher
{
public:
  CCommandWhatever *owner;

  CControlCageEditedEventWatcher(CCommandWhatever *owner) : owner(owner)
  {
  }

  virtual void OnReplaceObject(CRhinoDoc& doc, CRhinoObject &old_object, CRhinoObject &new_object) override
  {
    owner->handleControlCageEdit();
  }
};

CRhinoCommand::result CCommandWhatever::RunCommand(const CRhinoCommandContext &context)
{
  if(!setupComplete)
  {
    cageEditedHandler.Register();
    cageEditedHandler.Enable(TRUE);
    setupComplete = true;
  }
//........
}

(Steve Baer) #3

What would handleControlCageEdit do in this context?