.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/run_python_script/01_ten_bar_truss.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_run_python_script_01_ten_bar_truss.py: .. _ref_ten_bar_truss: Ten bar truss ------------- This example demonstrates how to to create an ARSM ten bar truss flow in batch mode using optiSLang python API. First, the ``arsm_ten_bar_truss.py`` file is used to create an ARSM ten bar truss flow. Then the ``ten_bar_modify_parameters.py`` and ``ten_bar_truss_lc2.py`` files are used to modify the flow. Lastly, the project is executed and a optionally the project is saved to a desired location. .. GENERATED FROM PYTHON SOURCE LINES 39-42 Perform required imports ~~~~~~~~~~~~~~~~~~~~~~~~ Perform the required imports. .. GENERATED FROM PYTHON SOURCE LINES 42-46 .. code-block:: Python from ansys.optislang.core import Optislang import ansys.optislang.core.examples as examples .. GENERATED FROM PYTHON SOURCE LINES 47-50 Create optiSLang instance ~~~~~~~~~~~~~~~~~~~~~~~~~ Create the optiSLang instance. .. GENERATED FROM PYTHON SOURCE LINES 50-54 .. code-block:: Python osl = Optislang(ini_timeout=60) print(osl) .. GENERATED FROM PYTHON SOURCE LINES 55-59 Get paths of example scripts and run them ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the paths of the example scripts and then run these scripts. .. GENERATED FROM PYTHON SOURCE LINES 59-68 .. code-block:: Python paths1 = examples.get_files("arsm_ten_bar_truss") paths2 = examples.get_files("ten_bar_modify_parameters") paths3 = examples.get_files("ten_bar_truss_lc2") osl.application.project.run_python_file(paths1[0]) osl.application.project.run_python_file(paths2[0]) osl.application.project.run_python_file(paths3[0]) .. GENERATED FROM PYTHON SOURCE LINES 69-72 Run workflow ~~~~~~~~~~~~ Run the workflow created by the preceding scripts. .. GENERATED FROM PYTHON SOURCE LINES 72-75 .. code-block:: Python osl.application.project.start() .. GENERATED FROM PYTHON SOURCE LINES 76-86 Optionally save project ~~~~~~~~~~~~~~~~~~~~~~~ If you want to save the project to some desired location, uncomment and edit these lines: .. code:: python path = r'' osl.application.save_as(os.path.join(path, "test_project.opf")) .. GENERATED FROM PYTHON SOURCE LINES 88-91 Stop and cancel project ~~~~~~~~~~~~~~~~~~~~~~~ Stop and cancel the project. .. GENERATED FROM PYTHON SOURCE LINES 91-94 .. code-block:: Python osl.dispose() .. GENERATED FROM PYTHON SOURCE LINES 95-103 View generated workflow ~~~~~~~~~~~~~~~~~~~~~~~ This image shows the generated workflow. .. image:: ../../_static/01_ten_bar_truss.png :width: 400 :alt: Result of script. .. _sphx_glr_download_examples_run_python_script_01_ten_bar_truss.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_ten_bar_truss.ipynb <01_ten_bar_truss.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_ten_bar_truss.py <01_ten_bar_truss.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_ten_bar_truss.zip <01_ten_bar_truss.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_