Managing ReplaceRhinoObject event


I am trying to do some actions at this event but only when a point is moved by the user. The problem is that I don’t know when this event is called by the moved point action or when an undo event has been fired.
At the documentation I found that RhinoDoc::UndoActive( ) and RhinoDoc::RedoActive() could help me but I can´t find them

(Rajaa Issa) #2

Check this event handling sample. It might help put you on the right path.


Thank you very much by your response rajaa but it doesn´t help me. I defined yet all the events I needed. My problem is that when the execution is at the override function of ReplaceRhinoObject I don´t know how to distinguish between both these events:

  • This event is fired when the user moves a point.
  • This event is fired when the user click the undo button (after moving a point).

(Rajaa Issa) #4

I think you probably figured it out in your first comment.
I was reading through the SDK documentation, and it appears that “RhinoDoc::UndoActive( )” indeed indicates that an undo is underway, and hence you would know that a “ReplaceObject” is called because of the undo. Did you try to check for the UnderActive inside your ReplaceObject event watcher?

(Menno Deij - van Rijswijk) #5

If you are using RhinoCommon, you can use the Command.UndoRedo event to monitor Undo/Redo.
From the members in the event arguments, it looks like the event is fired multiple times, at start and end of undo or redo commands.


and see


Sorry, I think I didn’t explain very well. I read the SDK documentation and I found the “RhinoDoc::UndoActive( )” but… How can I check the “UnderActive” or “UndoActive( )” you tell me? What NameSpace are from?

I solved the problem monitoring the UndoRedo even Menno said me, but I’m interested in knowing where the “RhinoDoc::UndoActive( )” is defined in order to use it so I could use less functions.

Thank you very much


Thank you so much Menno. I din’t know about the existence of UndoRedo event. I tried to use it and it works fine.

(Menno Deij - van Rijswijk) #8

RhinoDoc::UndoActive() and RhinoDoc::RedoActive() are in the C++ SDK, not in RhinoCommon.


Thank you very much. So, I´ll use the UndoRedo event monitoring