parameters: ()
docstring: Rhino automatically sets up an undo record when a command is run,
         but... the undo record is not saved if nothing changes in the
         document (objects added/deleted, layers changed,...)
      
         If we have a command that doesn't change things in the document,
         but we want to have our own custom undo called then we need to do
         a little extra work
docstring_summary: Rhino automatically sets up an undo record when a command is run,
         but... the undo record is not saved if nothing changes in the
         document (objects added/deleted, layers changed,...)
      
         If we have a command that doesn't change things in the document,
         but we want to have our own custom undo called then we need to do
         a little extra work
docstring_tokens: Rhino automatically sets up an undo record when a command is run but ... the undo record is not saved if nothing changes in the document ( objects added / deleted layers changed ... ) If we have a command that doesn t change things in the document but we want to have our own custom undo called then we need to do a little extra work
function: def TestCustomUndo():
      """Rhino automatically sets up an undo record when a command is run,
         but... the undo record is not saved if nothing changes in the
         document (objects added/deleted, layers changed,...)
      
         If we have a command that doesn't change things in the document,
         but we want to have our own custom undo called then we need to do
         a little extra work
      """
      current_value = 0
      if scriptcontext.sticky.has_key("FavoriteNumber"):
          current_value = scriptcontext.sticky["FavoriteNumber"]
      rc, new_value = Rhino.Input.RhinoGet.GetNumber("Favorite number", True, current_value)
      if rc!=Rhino.Commands.Result.Success: return
  
      scriptcontext.doc.AddCustomUndoEvent("Favorite Number", OnUndoFavoriteNumber, current_value);
      scriptcontext.sticky["FavoriteNumber"] = new_value
function_tokens: def TestCustomUndo ( ) : current_value = 0 if scriptcontext . sticky . has_key ( "FavoriteNumber" ) : current_value = scriptcontext . sticky [ "FavoriteNumber" ] rc , new_value = Rhino . Input . RhinoGet . GetNumber ( "Favorite number" , True , current_value ) if rc != Rhino . Commands . Result . Success : return scriptcontext . doc . AddCustomUndoEvent ( "Favorite Number" , OnUndoFavoriteNumber , current_value ) scriptcontext . sticky [ "FavoriteNumber" ] = new_value