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

Sep 14
- Sep 19
, 2026
IMTS 2026
Sep 15
, 2026
Simulation for Data Center Cooling Infrastructure - Webinar
Sep 16
, 2026
Ansys Simulation Solutions for Electrical Machines - Webinar
Sep 16
, 2026
Entry-Level Structural, Thermal and Flow Simulation - Webinar
Sep 23
, 2026
AZTC September After 5
Sep 30
, 2026
The Role of the Digital Twin in Modern Design and Engineering - Webinar
Oct 07
, 2026
2026 AZBio Awards
Oct 08
, 2026
White Hat Life Science Investor Conference
Oct 13
- Oct 14
, 2026
Ansys Transportation Summit & International LS-DYNA User Conference
Oct 21
, 2026
2026 Southern Arizona Tech + Business Expo
Oct 22
, 2026
Tucson Ansys Optics User Group Meeting
Oct 28
, 2026
Nerdtoberfest 2026
Nov 15
- Nov 18
, 2026
2026 ANS Winter Conference & 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: