How to export multiple figures at once?
Pierre Thieffry
Member, Moderator, Employee Posts: 107
✭✭✭✭
A customer wants to select multiple figures and store them in files with a single click.
Tagged:
0
Answers
-
Here's a short script that can be stored in a user button. It will save the file in the folder of the figures' parent analysis folders and use the parent result name for the the file name.
figures=ExtAPI.DataModel.Tree.ActiveObjects if (figures.Count == 0): mess_line1 = 'Please select at least one figure' MessageBox.Show(mess_line1) pass if (figures[0].GetType()!= Ansys.ACT.Automation.Mechanical.Figure): mess_line1 = 'Please select figure(s)' MessageBox.Show(mess_line1) pass for fig in figures: ExtAPI.DataModel.Tree.Activate(fig) anWD=fig.Parent.Parent.Parent.WorkingDir filename=anWD+'Figure - '+fig.Parent.Name+'.jpg' ExtAPI.Graphics.ExportImage(filename) msg = Ansys.Mechanical.Application.Message('Figure for '+fig.Parent.Name+' stored in folder '+anWD, MessageSeverityType.Info) ExtAPI.Application.Messages.Add(msg)
6