PyOptiSLang: Ansys Workbench integration: Register all project parameter and responses
Daniel Arnold
Member, Employee Posts: 13
✭✭✭
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