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:
Hi @dale
Think you, the core have run good by you way.
By the way, how cant I get the command name of undo\redo done, for example:
I move a object first, and then rotate it, and then I undo by “ctrl + z”, from there, it will undo the rotate step, now how cant I get the command name of undo restored ?