Saving Mechanical APDL Plots in a Design Study

Categories:

One of the cool features in the ANSYS Workbench is the ability to set up a design study and kick off a bunch of runs that bring back key parameters.  This is great for a design exploration but sometimes you actually would like a result plot, or maybe the info in a text file as well.  When a design study is done, unless you tell Workbench to save all your run files, it deletes all the files.

To do the posting on ICEM CFD in the workbench project page, I needed to do just that, so I thought I would share my method in case others want to use it.

The way I do it is pretty simple:

  • Use a /INQUIRE to get the directory the run is running in
  • Use some string functions to get the name of the design point from the directory name
  • Temporarily change the jobname
  • Save my plots
  • Change the jobname back to file
  • Copy the files to the User_Files directory.

Here is what it looks like:

   1: /post1

   2: set,last

   3: finish

   4: /inquire,aa,directory

   5: ii = strpos(aa(1),'dp')

   6: ij = strpos(aa(ii+1),'')-1

   7: dpn = strsub(aa(1),ii+1,ij)

   8: dpn = strcat(dpn,'_')

   9: /file,dpn

  10: /post1

  11: /view,1,1,1,1

  12: /vup,1,z

  13: /show,png

  14: eplot

  15: plnsol,u,sum

  16: /show,close

  17: /sys,copy *.png ......user_files

  18: finish

  19: /file,file

See how it uses /inquire to get the directory, then strpos(), strsub(), and strcat() to get the design point name.  Then it simply changes the file name, does a /show,png and plots. The results are copied using a system command.

Two important things to note:

  1. You have to do the set command before you change the jobname, otherwise your RST files will not work
  2. This version is written for windows, you need to use forward slashes and cp for Linux.

You can attach this to a MAPDL system or as a code snippet.

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter. Every month we share news about PADT, our partners, and our customers. We also share links to useful information on simulation, product development, and 3D Printing.  Sign up, and let's stay in touch.


By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events

10/15/2024

Sky's Not The Limit: The Power of SAF 3D Printing for Aerospace (re-ru

10/16/2024

Maxwell & Motor-CAD Updates in Ansys 2024 R2 - Webinar

10/16/2024

2024 Southern Arizona Tech + Business Expo

10/23/2024

PADT30 | Nerdtoberfest 2024

10/30/2024

Structural Update in Ansys 2024 R2 (2)

11/13/2024

Optics Updates in Ansys 2024 R2 - SPEOS, Zemax & Lumerical

11/13/2024

2024 Governor's Celebration of Innovation

11/27/2024

Fluent Updates in Ansys 2024 R2

12/11/2024

Structural Updates (3) in Ansys 2024 R2 - Materials, Contact & Joint

You Are Invited

PADT's Annual Open House
+
30th Anniversary Celebration
+
Arizona Manufacturing Pavilion

October 23, 2024
4:00 – 7:00
PADT’s Tempe Offices

Learn more and register at:
www.padtinc.com/nerdtoberfest

Search the PADT Site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: