October 17, 2023 at 2:05 pmKoen FranseSubscriber
I'm trying to get a macro that is normally used in Ansys Mechan
ical, working in PyAnsys scripting. Normally, the macro is called in a 'Commands (APDL)' section under the Solution tree of my Modal analysis:
Containing the following lines:
in which moma.mac is the macro. Now I want to be able to run the macro seperately, after the Modal analysis has finished, in PyAnsys scripting. Therefore I set 'Save MPADL db' to Yes in Mechanical.
In PyAnsys, I set the path to the simulation folder containing the .db file:
And read the .db file:
I run the psearch command and execute the macro in the same way as in Workbench:
This gives me the output "USE COMMAND MACRO moma", but I'm not sure if the macro is actually ran, since the output file I expect is not created in the folder as it is when I run the macro in Mechanical. Is there something I am still doing wrong?
Thanks in advance!
October 18, 2023 at 6:50 amErik KostsonAnsys Employee
I would suggest to post this in the pyAnsys/pyMAPDL forum – also is your macro post processing results, then we need to read in the rst file.
See: FILE (ansys.com)
All the best
October 18, 2023 at 7:21 amKoen FranseSubscriber
Thanks, I'll post it in the pyMAPDL forum on git!
October 18, 2023 at 8:22 amErik KostsonAnsys Employee
So if you are post processing which I think you are, then:
Issue file so (if you are in the same directory as the file.rst results, otherwise give the file path - see file command in help manual for more info):
All the best
- 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.
- Saving & sharing of Working project files in .wbpz format
- Solver Pivot Warning in Beam Element Model
- Understanding Force Convergence Solution Output
- An Unknown error occurred during solution. Check the Solver Output…..
- What is the difference between bonded contact region and fixed joint
- The solver engine was unable to converge on a solution for the nonlinear problem as constrained.
- whether have the difference between using contact and target bodies
- Defining rigid body and contact
- Colors and Mesh Display
- A solver pivot warning or error has been detected
© 2023 Copyright ANSYS, Inc. All rights reserved.