You can use the methods Export3D
and
ExportImage
to export graphics to 3D model files (STL and
AVZ) and image files (PNG, JPG, TIF, BMP, and EPS).
To export graphics to model and image files, you use the following commands:
Command | Description |
---|---|
Graphics.Export3D | Exports the model to an STL or AVZ file. |
Graphics.ExportImage [a] | Exports the image to a PNG, JPG, or BMP file. |
[a] This method supports no GUI mode in Workbench.
This code exports the model to a binary STL file:
setting3d = Ansys.Mechanical.Graphics.Graphics3DExportSettings() Graphics.Export3D("c:\\temp\\binarySTL.stl", Graphics3DExportFormat.BinarySTL, setting3d)
This code exports the image to a PNG file:
setting2d = Ansys.Mechanical.Graphics.GraphicsImageExportSettings() Graphics.ExportImage("c:\\temp\\imagePNG.png", GraphicsImageExportFormat.PNG, setting2d)
For information on changing the 3D model or image export settings, see Graphics3DExportSettings or GraphicsImageExportSettings in the ACT API Reference Guide.
The following script exports the model with a white background to an AVZ file and exports the image with enhanced resolution to a PNG file.
#export model to AVZ file with white background setting3d = Ansys.Mechanical.Graphics.Graphics3DExportSettings() setting3d.Background = GraphicsBackgroundType.White Graphics.Export3D("c:\\avz_white.avz", Graphics3DExportFormat.AVZ, setting3d) #export image with enhanced resolution to PNG file setting2d = Ansys.Mechanical.Graphics.GraphicsImageExportSettings() setting2d.Resolution = GraphicsResolutionType.EnhancedResolution Graphics.ExportImage("c:\\temp\\image_enhancement.png", GraphicsImageExportFormat.PNG, setting2d)