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.

Share this post:

Upcoming Events

Apr 23
, 2026
Access the Right Material Data Directly Inside Your Simulation Workflow - Webinar
Apr 23
, 2026
Ansys 2026 R1: Ansys Digital Twin What’s New
Apr 27
- Apr 30
, 2026
Nuclear and Emerging Technologies for Space (NETS) 2026
Apr 28
, 2026
Uncertainty Quantification for Real‑World Model Deployment in Industrial Systems - Webinar
Apr 28
, 2026
Ansys 2026 R1: Ansys Sherlock and Electronics Reliability What’s New
Apr 29
, 2026
Ansys 2026 R1: Structural Mechanics What’s New
Apr 30
, 2026
Ansys 2026 R1: What’s New in Ansys Optics
May 07
, 2026
Ansys 2026 R1: Ansys LS-DYNA What's New
May 13
, 2026
2026 Arizona Manufacturing Showcase
Jun 18
, 2026
E-Mobility and Clean Energy Summit
Jul 15
, 2026
Arizona Aerospace Summit
Aug 10
- Aug 11
, 2026
2026 CEO Leadership Retreat + Golf Tournament
Oct 21
, 2026
2026 Southern Arizona Tech + Business Expo
Nov 18
, 2026
2026 Governor’s Celebration of Innovation

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: