July 26, 2023 at 7:00 pmSterling ButtersSubscriber
Greetings, 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 pmmjmiddleAnsys Employee
from SpaceClaim.Api.V23 import Application
from SpaceClaim.Api.V23.Scripting.Internal import TransactionHelper
Application.Undo(1) # number of steps to undo
#Application.Redo(1) # number of steps to redo
#Application.PurgeUndo(0) # number of steps to keep
# 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 pmSterling ButtersSubscriber
@mjmiddle Thanks! What argument is passed to the
BeginCommandmethod in your example i.e. what is “Script”? Is it the name of the active
.scscriptfile? I guess more generally, what command is being “begun” after the
August 1, 2023 at 12:04 ammjmiddleAnsys Employee
These 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 pmSterling ButtersSubscriber
@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.
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
© 2023 Copyright ANSYS, Inc. All rights reserved.