-
-
February 24, 2023 at 3:21 pm
m.vp2209
SubscriberHello, I am trying to automate a workflow in Workbench and would be grateful for some ideas. At the moment my simulation solves several transient thermal analyses, in which the solution temperature distrubution of an analysis A is imported an initial condition for the next B analysis. The geometry is not the same and therefore I am importing the initial temperature condition via an external data block in WB. This process is very tedious to do manually and I have managed to create a button using ACT Scriptting in Mechanical to export my temeprature profiles to txt files. But now I have to press the button manually everytime the solution is obtained. Is there a way to make Mechanical export the data directly without me pressing a button? Then for the other task, which is creating and setting up the external data files I have also created a scrip using ACT. I wrote my python script and then make WB read it. This means that I have to read my scrip everytime an analysis is finishes and I want this operation to be performed. Is there a way of making workbench solve my mechanical system A, save the results to txt (without me pressing a button) and directly creating the external data for mechanical system B? To this, is there a way to "enter" mechanical via the python scripting of WB? So I could develop a code that first saves the txt files in system A and directly generates the external data block and imports loads into system B. Thanks in advance! -
March 2, 2023 at 5:41 pm
Aniket
Ansys EmployeeHi,
for executing an existing mechanical code, you should be able to use python code object in your model:
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/wb_sim/ds_python_code_Event.html
Also, to send Mechanical commands from the workbench you can use:
If the ACT python commands are directly being sent without an extension one can use the SendCommand API https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/wb2_js/ContainerName30.html:
system = GetSystem(Name=”SYS”) # Specify system name, or
#system = GetAllSystems()[0] # get first system
model = system.GetContainer(ComponentName=”Model”)
model.SendCommand(Language=”Python”, Command=string)
If the python commands that are being sent from Workbench Journal are a part of a Mechanical extension, then use the following commands:
string=”’ExtAPI.ExtensionManager.GetExtensionByName(‘Extension name’).ScriptScope.My_Python_command()”'
model.SendCommand(Language=”Python”, Command=string)-Aniket
How to access Ansys help links
Guidelines for Posting on Ansys Learning Forum
-
- 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.
- 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
- whether have the difference between using contact and target bodies
- The solver engine was unable to converge on a solution for the nonlinear problem as constrained.
- User manual
- Colors and Mesh Display
- material damping and modal analysis
-
3744
-
2573
-
1821
-
1236
-
594
© 2023 Copyright ANSYS, Inc. All rights reserved.