General Mechanical

General Mechanical

How to automatically export the frequency response spectrum as .txt/.xls files using Ironpython?

    • Gabu
      Subscriber

      Hello everyone,

      I'm recently study the Automation functions of Ansys with Ironpython script. After doing a harmonic response analysis I want to let the software excute the code to export the data of frequency response (including frequency, amplitude and phase) into a specific directory. However, the only option I found was to use the following code to trigger the DoExprotToTextFile function and then the export window pops up. By this way I still need to type in/select the directory and click the save button. Can anyone give me some advice to optimize the code? I mean, is there anyway that I can let the exporting become fully automatic without manually select the directory and click the button? Thank you very much!😀

    • Aniket
      Ansys Employee
      As you might have noticed, when you record this, you get an unpublished APIs warning in the recorder. InternalObject is not published either, but have some functions such as GetAmpAtFrequency GetPhaseAtFrequency that can be used as follows, you will need to add a loop to loop on all the frequencies:
      dx.InternalObject.GetAmpAtFrequency(freq, 0)
      dx.InternalObject.GetPhaseAtFrequency(freq)
      -Aniket
      How to access Ansys help links
      Guidelines for Posting on Ansys Learning Forum
Viewing 1 reply thread
  • You must be logged in to reply to this topic.