General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Access Geometric Parameters Using PyMechanical

    • fathalla
      Subscriber

      Hello everyone,

      I am a PhD student and I am new to scripting in Mechanical but I already have some experience in Python. I would like to automate the simulation process of a 2D axisymmetric model using Static Structural Analysis so I am resorting to using PyMechanical by running Python scripts in Ansys Mechanical through VS Code using the ansys.mechanical.core package. I have already been able to run a full simulation through VS Dode.

      The geometry I am using is a Parametarized Model made in Siemens NX and has to be imported into Mechanical with the Parameter Key "PH". The parameters can then be adjusted to vary the geometry without the need to modify the model on NX.

      Doing this manually on Workbench is simple:

      Unfortunately, I am not able to read or adjust these Parameters using scripting. I am also not even able to enter the correct Parameter Key.

      This is one of the attempts I made to try and incorporate the Parameters using scripting:

      When I try to change these options manually through the GUI, I am able to apply the changes I need but the Parameter are still not displayed. How can I use scripting to detect the Geomteric Parameters and adjust them in order to rerun the simulation?

       My experiment aims to produce a very large number of simulations while varying these parameters, so doing this process manually through Workbench each time is out of the question.

      I highly appreciate you help in this matter as I have not been able to find any helpful resouces online.

      Thank you in advance

       

    • Erik Kostson
      Ansys Employee

       

      Hi

      No need for scripting.

      Set them as parameters and run a design of experiment study. See here for a tutorial

      https://designinformaticslab.github.io/productdesign_tutorial/2016/11/20/ansys.html

      All the best

      Erik

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.