Rhino can record changes that occur to the Rhino document. These change can be undone.
If you write Rhino commands, then Rhino will record changes that occur to the Rhino document automatically.
If you have some kind of “modeless” user interface, such as a docking panel or modeless dialog box - something that modifies the Rhino document outside of a Rhino command - then you will need to record changes to the Rhino document yourself if you want those modifications to be undoable.
Note carefully: If you call RhinoDoc.BeginUndoRecord then you must call RhinoDoc.EndUndoRecord, otherwise you will break undo recording.
Note, Rhino’s undo recording only applies to changes to the Rhino document. Anything else you want to track, you will have to code up yourself.
One option is to add a custom undo event to the Rhino document using RhinoDoc.AddCustomUndoEvent. After doing this, if a user run the Undo command, your custom undo event handler will be called, allowing you to “undo” whatever you want.