July 31, 2023 at 4:01 pm
Ansys Employee
from SpaceClaim.Api.V23 import Application
from SpaceClaim.Api.V23.Scripting.Internal import TransactionHelper
def Undo():
TransactionHelper.EndCommand()
Application.Undo(1) # number of steps to undo
#Application.Redo(1) # number of steps to redo
#Application.PurgeUndo(0) # number of steps to keep
TransactionHelper.BeginCommand("Script")
Undo()
# The Undo(), Redo(), PurgeUndo() must be done within the EndCommand()/BeginCommand() block and inside a function or else the BeginCommand() cannot resume GUI operation.