Undo Record insid command

Hello,

I know that all commands after finalization are written to undo and can be undone with the “undo” command.

But, in my command I have to undone some actions during script execution, so , I remember try use the
“BeginUndoRecord” and “EndUndoRecord” only actions that can be undone.

Ex:
var customUndo = Rhino.RhinoDoc.ActiveDoc.BeginUndoRecord(“UndoCuston”);
“”""" do stuff"""""
Rhino.RhinoDoc.ActiveDoc.EndUndoRecord(undo);

if (condition==true)
{
customUndo
}

it’s possible?

thanks

Hi @MatrixRatrix,

No, it is not possible to create an undo record inside of a command as the command creates one.

What exactly are you trying to do and why?

– Dale

Hi @dale

Basically I have a loop inside a command that make some change on objects, and make some checks, if this check is OK the command stop, but if the check is not OK then undo all and check again with some different variables, ans make this until the check is OK or the time out.

I could delete all and start again, but I need the original Guu don’t change, if create a new one the Gui change.

Hi @MatrixRatrix,

Most commands that support Undo while the command is running maintain an internal structure of changes or additions. The Polyline is an example of this. When the command is done, all of the changes are dumped into the document.

– Dale