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!
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to work with STL file?
- Rotate tool in ANSYS Design Modeler
- section plane
- Using Symmetry in DesignModeler and Expanding the Results
- ANSYS FLUENT – Operation would result in non manifold bodies
- drawing a geometry by importing a table of points
- material properties
- Coordinates orientation
- “contact pair has no element in it.” how to resolve this problem
- Parameters not imported into Workbench 18.2 from Solidworks/Inventor
-
7742
-
4500
-
2957
-
1449
-
1322
© 2023 Copyright ANSYS, Inc. All rights reserved.