How save results picture with a script
Hello everyone,
I am currently working on a 2D FEA thermal simulation on Ansys Mechanical for which I am using a script as I have a lot of different boundary conditions to use. I have field temperature I would like to save at each iteration of my script, see just after :
This last field being the result of the user defined expression.
The question is then simple, how save this picture at each iteration of my script ? I know that I can save the current image (I mean the one which appears at the screen) with the following command but how specify that I want to save the picture of the user defined result ?
Ansys.Mechanical.Graphics.GraphicsImageExportSettings().CurrentGraphicsDisplay
Thank you !
Pierre
Comments
-
Hello,
No idea ? I don't think I'm the only one who needs to save the results of my simulations?Thank you,
Pierre0 -
Hi
I hope the below does what you want:
model = ExtAPI.DataModel.Project.Model solution=model.Analyses[0].Solution user_defined = solution.AddUserDefinedResult() user_defined.Expression = r'UY' user_defined.EvaluateAllResults() Tree.Activate(user_defined) # activate the result in the tree (so it becomes visible in the window) image_settings = Ansys.Mechanical.Graphics.GraphicsImageExportSettings() image_settings.CurrentGraphicsDisplay = True ExtAPI.Graphics.ExportImage('D:/mytestimage.png', GraphicsImageExportFormat.PNG, image_settings)
The user_defined expression can be seen in the ui and the results (top left).
If one wants instead a screenshot of the whole screen and thus of the whole UI, and not only the model window inside mechanical where the results are, then the below post might be of help:
Thank you and kind regards
Erik
0 -
Dear Erik,
Thank you very much for your answer ! I will try it and will come back to you . Sorry for the delay of my answer I do not know how but I have missed your answer.Best regards,
Pierre0