Search for Keyword and Export

Goal: Loop through all results that contain a keyword of For Image and export the image shown to a directory.

You must specify the path in the first line.

Code:

path = "C:\\"
n = 0

model = ExtAPI.DataModel.Project.Model
view_manager = ExtAPI.Graphics.ModelViewManager

for analysis in ExtAPI.DataModel.Project.Model.Analyses:
    sol = analysis.Solution
    for sol_obj in sol.Children:
        if sol_obj.Name.Contains("For_Image"):
            n += 1
            sol_obj.Activate()
            view_manager.CaptureObjectImage(sol_obj, "PNG", path)

Release 18.2 - © ANSYS, Inc. All rights reserved.