TAGGED: ansys-apdl, ansys-mapdl, apdl
-
-
May 24, 2025 at 5:00 pm
azj
SubscriberHello, I'd like to ask about saving .png pictures by using APDL commands.
I'm trying to automatize my workflow using APDL and /SHOW,FILENAME,PNG command to save my pictures in a folder different from the job directory.
I am trying the following:
PLNSOL('TEMP')
/SHOW,'C:\Users\my_path\my_picture',PNG
/REPLOT
/SHOW,CLOSEWith these lines, a file named 'my_picture.png' is generated in the desired path but it seems to be corrupted as I'm not able open it (Windows shows a message saying that 'the format is not compatible' but it should be a .png).
Am I missing something?
Thank you very much.
Best regards,
Antonio.
Â
-
May 26, 2025 at 1:06 pm
Ashish Khemka
Forum ModeratorHi Antonio,
Please see if the following link helps: Saving Mechanical APDL Plots in a Design Study - PADT
Regards,
Ashish Khemka
Introducing Ansys Assistant a 24/7 AI-powered virtual assistant for active Ansys academic customers.
-
May 26, 2025 at 2:02 pm
azj
SubscriberHello Ashish,
Thank you very much for your response.
I did that you suggest and I implemented it. It works well but I wonder why that I posted is not working.
Saving the pictures by /SHOW,'PATH',PNG command seems to be easier to automatize as It is not needed to find out the *.png file, copy it to a new directory and rename it.
I will wait a bit to see if anyone else has any clue and then I will mark the post as answered.
Best regards,
Antonio.
-
May 26, 2025 at 2:06 pm
Ashish Khemka
Forum ModeratorHi,
Please see if the following post helps you. The user sees similar issue where image was corrupted:
How to export high resolution images in APDL
Regards,
Ashish Khemka
-
May 26, 2025 at 2:18 pm
azj
SubscriberI've seen it and tried to do the same as the last answer suggests but it didn't solve it.
The issue seems to be the same but unfortunately the problem kept unresolved in this thread.
I have also thougth that it could be due to any kind of conflict with Windows or graphic card configuration such as a problem with screen resolution, but I tried to launch the commands after lowering my screen resolution and it didn't work either.
Again, thank you so much.
Best regards,
Antonio.
-
May 26, 2025 at 5:21 pm
mrife
Ansys EmployeeHi Antonio
Well there are a few things wrong. It looks like to me you are mixing APDL and PyMAPDL command styles in the PLNSOL command. And the FNAME field of the /SHOW command is the device name, not a path. So instead of
PLNSOL('TEMP')
/SHOW,'C:\Users\my_path\my_picture',PNG
/REPLOT
/SHOW,CLOSEUse the following:
PLNSOL,TEMP
/SHOW,PNG
/REPLOT
/SHOW,CLOSEYou could then use /COPY to copy the jobname000.png file to the specific folder you want.
Mike
-
May 27, 2025 at 7:04 am
azj
SubscriberHi Mike,
Thank you for your response.
You are right. I mixed both languages. This code was originally intended for use in PyAnsys (mapdl.show('C:\Users\my_path\my_picture','png'...) and I obtained 'corrupted' *.png files. Then I tried using the same code in APDL (/SHOW,'C:\Users\my_path\my_picture','PNG...) with same results. In my first post both languages are mixed because I made a mistake when I transcribed the code but both codes (pyAnsys and APDL) generated the same wrong *.png files.
I have read again the documentation (https://ansyshelp.ansys.com/public/account/secured?returnurl=/Views/Secured/corp/v251/en/ans_cmd/Hlp_C_SHOW.html?q=%2Fshow). It says:
FnameDevice name, file name, or keyword, as listed below:
....
Now, I understand that 'file name' is referred to the output extension ('PNG', 'TIFF', 'JPG') and not a path.
With /COPY method I have no problems so I will use it.
Thank you both again for your responses.
I will mark the post as answered.
Best regards,
Antonio.
-
May 27, 2025 at 8:29 am
ErKo
Ansys EmployeeThanks for your feedback - closing here as others might find this useful.
Â
All the best
Â
Erik
-
- The topic ‘/SHOW command for saving .png’ is closed to new replies.
-
6535
-
1906
-
1463
-
1311
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.