How can I set the script path of a PythonActor?
Daniel Arnold
Member, Employee Posts: 16
✭✭✭
I want to create an Ansys optiSLang project using optiSLang's python API.
In the project a python node should be added and the path to a script should be used.
How can I do that?
Tagged:
0
Best Answer
-
This can be done in few simple steps/lines:
1. define aRelativeSplittedPath
to the script:import stdcpp_python_export csv_path = r"c:\path\to\script.py" osl_csv_path = stdcpp_python_export.RelativeSplittedPath(csv_path, stdcpp_python_export.BasePathMode.PROJECT_RELATIVE)
- Add a
PythonActor
into the project:
pyactor = actors.PythonActor("Python") add_actor(pyactor)
- Set the
path
property of the actor:
pyactor.path = osl_csv_path
further information can be found at: Ansys optiSLang Python API
0 - Add a