PyOptiSLang: Ansys Workbench integration: Register all project parameter and responses
Daniel Arnold
Member, Employee Posts: 16
✭✭✭
How can I
1. add an Ansys Workbench integration node to the Ansys optiSLang project
2. register defined parameter and responses
Tagged:
0
Best Answer
-
That's possible in few easy steps:
- Import modules
from ansys.optislang.core import Optislang from ansys.optislang.core.nodes import IntegrationNode, DesignFlow import ansys.optislang.core.node_types as node_types
- create Ansys optiSLang class object
osl = Optislang(ini_timeout=240)
- create Ansys Workbench integration node
root_system = osl.application.project.root_system wb_node: IntegrationNode = root_system.create_node( name='WB', type_=node_types.awb2_plugin, design_flow=DesignFlow.RECEIVE_SEND ) wb_node.set_property( name="WorkbenchProjectFile", value={ "path": { "base_path_mode": {"value": "ABSOLUTE_PATH"}, "split_path": {"head": "", "tail": "coupled_function.wbpz"}, } }, )
Example can be found at Coupled Function optiSLang Tutorial example
4. register parameter and responseswb_node.load() wb_node.register_locations_as_parameter() wb_node.register_locations_as_response()
- run project
osl.application.project.start(wait_for_finished=True)
0
Answers
-
In relation to this discussion, I’d like to know where I can find a list of the adjustable properties of each node type. In my case, I want to edit the run options inside the wb_node. I’ve done it in optiSLang, and now I want to be able to do it in PyOptiSLang.
0 -
Hi @Leire,
there are basically two ways of getting those information:
1. you can extract the json object withpython_node.get_properties()
2. open your created project with Ansys optiSLang GUI and open Project overview:1