TAGGED: #python-#ironpython, ansys-spaceclaim, api, python, spaceclaim
-
-
July 26, 2023 at 7:00 pm
Sterling Butters
SubscriberGreetings, is it possible to access undo/redo operations from the python API? The record feature does not appear to pick up on these actions and seems like to basic of a feature to not be implemented in the API. Thanks in advance!
-
July 31, 2023 at 4:01 pm
mjmiddle
Ansys Employeefrom 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.
-
July 31, 2023 at 4:10 pm
Sterling Butters
Subscriber@mjmiddle Thanks! What argument is passed to the
BeginCommand
method in your example i.e. what is “Script”? Is it the name of the active.scscript
file? I guess more generally, what command is being “begun” after theApplication.Undo(1)
operation? -
August 1, 2023 at 12:04 am
mjmiddle
Ansys EmployeeThese are unsupported commands, and I gave you a workable method to do what has not been supported or documented. Just use the BeginCommand("Script") exactly as shown, with the string "Script" as the argument. If you try use the undo command outside of the Begin/EndCommand, you'll get an error:
Cannot undo or redo when a command is being executed.
The Begin/EndCommand allows it to halt the GUI mouse/keyboard event loop to do the command and then start the event loop again. Use the script as shown or you will run into problems.
-
August 1, 2023 at 2:04 pm
Sterling Butters
Subscriber@mjmiddle Thanks so much again! So glad this forum exists!
-
- The topic ‘SpaceClaim Python API: Undo/Redo Operations’ is closed to new replies.
- FSAE CFD – Lesson 1 Preparation question (Using Discovery)
- Script for subtracting models
- No preview in explorer with scdox file
- Project lines/edges into a face with the direction normal to the face
- Multiple Instances of SpaceClaim taking multiple licenses
- Spaceclaim file reference error
- Issues after installing new service pack 2024R1 (sp5)
- Add-in Error Excel
- Problems with loading my Discovery Mesh into Fluent
- Missing SubDivWrapper.dll
-
3862
-
1414
-
1220
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.