You use the following command to insert an image object into the Outline. The object includes properties that enable you to specify the image's location in the Geometry window. You can place it on or around your model.
image_plane = model.AddImagePlane()
Properties | Description |
---|---|
Height | Gets or sets the physical height of the image plane. |
Width | Gets or sets the physical width of the image plane. |
PixelHeight | Gets the pixel height of the plane's image. |
PixelWidth | Gets the pixel width of the plane's image. |
ImageFilePath | Gets the file path for the rendered image. |
Import | Sets the image which is rendered to this plane, specified by filePath. Upon success, the ImageFilePath will be set to the filePath. Upon failure, ImageFilePath will remain unchanged. Supported file formats include PNG, JPEG, BMP, and GIF. If this is the first time an image has been set to this image plane and if Width and Height were never modified, the image plane will be automatically sized based on the model’s bounding box, respecting the image’s aspect ratio. |
Translucency | Gets or sets the translucency of the plane, as a percentage ranging from 0 to 100. |
CoordinateSystem | Gets or sets the coordinate system object used for defining the plane’s location and orientation. This property is restricted to cartesian coordinate systems. |
FlipHorizontally | Gets or sets whether the rendered image on the plane should be flipped horizontally. |
FlipVertically | Gets or sets whether the rendered image on the plane should be flipped vertically. |
ShowAlways | Gets or sets whether the image plane will be shown independent of the active object in the tree. |
CoordinateSystemVisible | Gets or sets whether the annotation for the image’s coordinate system is rendered. |
Example 1
`
The following code adds an image to the model.
# model is a reference to an instance of Ansys.ACT.Automation.Mechanical.Model imageOne = model.AddImagePlane() # creates image plane object imageOne.Import(“C:\\example.png”) # on success, sets ImageFilePath and renders the image on the plane # image plane from screen shot of graphics window imageTwo = model.AddImagePlane() Graphics.ExportScreenToImage(“C:\\ANSYSDev\\example2.png”) imageTwo.Import(“C:\\ANSYSDev\\example2.png”)
Example 2
The following code changes the location of the image in the Geometry window.
# modifying location and dimensional properties of the image plane imageOne.CoordinateSystem = csysObj # sets the bottom left corner of the plane at the CSYS’s location imageOne.Width = Quantity(2.5, ‘m’) # sets world width of the plane imageOne.Height = Quantity(250, ‘cm’) # sets world height of the plane
Example 3
The following code changes certain view properties of the object.
# modifying view properties of the image plane imageOne.Translucency = 30 # sets the plane to 30% translucency (70% opacity) imageOne.FlipHorizontally = True # flips the horizontal orientation of the rendered image (not of the physical plane) imageOne.FlipVertically = False # flips the vertical orientation of the rendered image (not of the physical plane) imageOne.CoordinateSystemVisible = True # annotates the coordinate system the image is attached to ImageOne.ShowAlways = True # allows the image to be rendered no matter what object is active in the tree