Export Result Images to Files

Goal: Export all result in the tree to PNG (2D image) and AVZ (3D image) files.

Code:

# get a list of all the results in the project
results =ExtAPI.DataModel.Tree.GetObjectsByType(DataModelObjectCategory.Result)

#loop over the results
for n in range(0,results.Count):
	
	# select and activate the result                      
	result = results[n]
	result.Activate()
	
	# export the result to avz file using the result name for the filename
	mvm = ExtAPI.Graphics.ModelViewManager
	avzFilename = "D:\\Images\\" + result.Name + ".avz"
	mvm.Capture3DImage(avzFilename)

	# export the result as a 2D PNG file
	mvm.CaptureModelView(result.Name,"PNG","D:\\Images")
	
print "Done with Exporting Results"

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