General Mechanical

General Mechanical

Automating extraction of tabular data

    • Maks Brus
      Subscriber

      Greeting to everyone!

      I am currently working on a project in Ansys Student 2023, where I would need to make many iterations based on location of a certain part (let's say a couple of thousand different locations). The model was drawn in SolidWorks and the x and y parameters for location were also imported and parameterized. Now I need to do a Modal analysis and Harmonic analysis. 


      Figure 1: Imported parameters (currently only 3 for testing purposes).

      From harmonic analysis I would like to export a CSV (or similar) for the tabular data of Frequency response deformation for each design point. Currently I have spent the whole weekend trying to find a solution. 

      Figure 2: Tabular data I would like to export

      I found this (Figure 3) and it seems to work, BUT! It only works in Mechanical. If I update all design points it doesn't generate the files:
      https://blog.ozeninc.com/resources/using-python-to-export-tabular-data-from-within-ansys-mechanical
      The reason is that this method only works with the Mechanical GUI:
      https://forum.ansys.com/forums/topic/tabular-data-extraction/


      Figure 3: The Python script, slightly modified to work.

      Now is there any way of doing this with Python? Or any other way of doing this? I have found APDL and VWRITE, but have no clue in this regard.

      *Disclamer: Total Ansys beginner and basic Python knowledge.

      **Also: This seems like something that should be integrated.

    • Erik Kostson
      Ansys Employee

       

      Hi

      By default, the Python objects are not connected, for security purposes. It is possible to activate an option to automatically connect the Python objects. This is mandatory to be able to use Python objects in a Design Point experiment.

      The option is: activate the Connect/Run Python Code Objects when Mechanical is Launched preference contained in the Mechanical category of the Workbench Options dialog (Tools > Options > Mechanical):

      image.png

       

      image.png
      image.png

       

      See this page of the help for further information: https://ansysproducthelpqa.win.ansys.com/account/secured?returnurl=/Views/Secured/corp/v231/en/wb_sim/ds_python_code.html

      In the future should you have any scripting related questions you can also post here:

      https://discuss.ansys.com/categories/engineering-simulation

      Thank you

      Erik

       

    • Maks Brus
      Subscriber

      Thank you for your answer Erik!
      But it doesn't solve the problem as I had the option enabled before posting the question. The script runs, but it doesn't work because it requires Mechanical GUI, which doesn't open if you update all design points from Workbench.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.