A button to save a screenshot of the selected element in the Tree

sombodyfromtheworld
sombodyfromtheworld Member Posts: 26
First Comment Name Dropper
edited February 12 in General Language Questions

Hi,
I made a custom button to save screenshots from my analysis:

image_settings = Ansys.Mechanical.Graphics.GraphicsImageExportSettings()
image_settings.CurrentGraphicsDisplay = True
file_name = Tree.FirstActiveObject.GetType().Name + '.png'
Graphics.ExportImage('C:/.../.../files/'+file_name, GraphicsImageExportFormat.PNG, image_settings)

All works fine except that I need a custom name of the final file to be equal to the actual name of the element in tree I select.
For instance if I have several Equivalent Stress results, they all will be overwritten in one file: EquivalentStress.png based on this line:
file_name = Tree.FirstActiveObject.GetType().Name + '.png'

Answers