Using Mechanical Scripting, how can I export images of results?
Landon Mitchell Kanner
Member, Employee Posts: 290
✭✭✭✭
Comments
-
for analysis in ExtAPI.DataModel.AnalysisList: analysisName = analysis.Name solution = analysis.Solution for child in solution.Children: childName = child.Name +"_"+ analysisName child.Activate() imagePath = "D:/{}.png".format(childName) ExtAPI.Graphics.ExportImage(imagePath)
1 -
Hello @Landon Mitchell Kanner , Thanks for sharing this.
How to save these results in working directory?
Lets say we have defined working directory as dirName = ExtAPI.DataModel.Project.Model.Analyses[0].WorkingDir0 -
Haven't tested it, but it would be something like:
import os for analysis in ExtAPI.DataModel.AnalysisList: dirName = analysis.WorkingDir analysisName = analysis.Name solution = analysis.Solution for child in solution.Children: childName = child.Name +"_"+ analysisName child.Activate() imageName = "{}.png".format(childName) imagePath = os.path.join(dirName,imageName) ExtAPI.Graphics.ExportImage(imagePath)
0