Cant not undo after use RhinoDoc.ReplaceRhinoObject event

Hi @pythonuser,

Its never a good idea to do what you are doing where you are doing it. Rather, when your RhinoReplaceObjectsEventArgs delegate is called, set flag and save some data somewhere. Then in a RhinoApp.Idle event handler, check your flag (to make sure something happened) and then do what you want.

In regards to why your transformation is not undoable, only ‘stuff’ that happens in between a ‘begin undo recording’ and ‘end undo recording’ is undoable. Rhino records this automatically for commands. If you not in a command, then you will need to do something like this:

var sn = doc.BeginUndoRecord("My Stuff");
// TODO...
if (sn > 0)
 doc.EndUndoRecord(sn);

Another option is to script a command that you’ve written. See my reply to this thread:

– Dale