Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

/SHOW command for saving .png

    • azj
      Subscriber

      Hello, 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,CLOSE

      With 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.

       

    • Ashish Khemka
      Forum Moderator

      Hi 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.

    • azj
      Subscriber

      Hello 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.

    • Ashish Khemka
      Forum Moderator

      Hi,

      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

    • azj
      Subscriber

      I'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.

    • mrife
      Ansys Employee

      Hi 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,CLOSE

      Use the following:

      PLNSOL,TEMP
      /SHOW,PNG
      /REPLOT
      /SHOW,CLOSE

      You could then use /COPY to copy the jobname000.png file to the specific folder you want.

      Mike

    • azj
      Subscriber

      Hi 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:

      Fname

      Device 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.

    • ErKo
      Ansys Employee

      Thanks for your feedback - closing here as others might find this useful.

       

      All the best

       

      Erik

Viewing 7 reply threads
  • The topic ‘/SHOW command for saving .png’ is closed to new replies.
[bingo_chatbox]