General Mechanical

General Mechanical

Automating extraction of tabular data

    • Maks Brus

      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:
      The reason is that this method only works with the Mechanical GUI:

      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



      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):





      See this page of the help for further information:

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

      Thank you



    • Maks Brus

      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.