Plotting and Exporting Images
For a number of model entities, two methods for plotting and exporting images are available:
image().plot() plots the model entity in a window. The plotting is available when running a graphics server. The plot() method does nothing when run from a model method.
image().export() exports an image of the model entity to file.
To set properties related to the plotting or export of images, use the standard set method on the image() object.
The following examples show the basic usage of these methods.
This example plots a geometry sequence in a window:
model.geom("geom1").image().plot();
This example exports a physics interface to a PNG file.
model.physics("es").image().set("pngfilename", "C:\physics.png");
model.physics("es").image().export();
The image() method is available for many objects in, for example, the lists model.common(), model.cpl(), model.coordSys(), model.func(), model.geom(), model.material(), model.mesh(), model.multiphysics(), model.pair(), model.physics(), model.physics(<tag>).feature(), model.probe(), and model.selection().
Properties for the image() Objects
The following properties are available for the export of images:
Table 2-111: Export Properties
on | off
on | off
If options is on: enable or disable display of the coordinate axes. Used for 1D and 2D plots.
on | off
If options is on: enable or disable display of the axis orientation indicator. Used for 3D plots.
current | color | transparent
If background is color: the red, green, and blue components of the background color.
on | off
If options is on: enable or disable display of the coordinate grid. Used for 3D plots.
on | off
If on, the aspect ratio of the image is preserved when the width or the height is changed.
bmp | eps | jpeg | png | tiff | gif
The type of image to export. eps can only be used for 1D plots.
on | off
If options is on: enable or disable display of the logotype.
on | off
current | web print | presentation | custom | any custom size settings
How to specify the size and resolution of the image. The value current gives a 800x600 image with the resolution 96 dots per inch. The values manualweb and manualprint let you give a size and resolution suitable for the web or printing, respectively, but also let you specify the size and resolution manually.
on | off
If options is on: enable or disable display of the title.
px | mm | in
* When making an image export, the value of the image feature doing the export will be stored and used as the default value when creating a new image feature. The image feature is created the first time the image() method is called.
The following properties are related to plotting of images:
new | window tag
The window to plot in. The window tags must be of the form windowN, where N is an integer (for example, window3).
The window’s title. The default is Plot N, where N is taken from the window tag.
The following properties are used for both export and plotting of images:
on | off | fromview
Whether to use wireframe rendering for the geometry. The value fromview specifies that the view controls the rendering. The other values override the view setting. This property is only available in 3D and only for the features that plot a selection. This excludes geometries, meshes, and functions.
auto | view tag
The view settings to use when displaying this image. auto indicates that the view is selected automatically and will be the current view for the geometry being displayed.
on | off
nozooming | zoomextents | zoomtoselection
The tables below contain properties that are available for image() objects attached to a certain parent type.
The following property is used when attached to a geometry object:
Table 2-114: Geometry Property
on | off | fromview
on | off | fromview
The only difference for the showmaterial and showselection properties for the geometry is that the values are taken from the view by default- They are off by default for all other features (such as probes and physics features).
The following property is used when attached to a pair object:
Table 2-115: Pair Property
srcanddst | source | destination
The following property is used when attached to a physics feature or multiphysics coupling object:
main | selection name
Which selection to display. Some physics features and multiphysics couplings have multiple selections. The value main corresponds to the selection retrieved by calling selection() on the physics feature or coupling, and the other values are the names to obtain a selection using selection(<name>).
The following property is used when attached to a component coupling object:
Table 2-117: Pair Property
srcanddst | source | destination
source | srcvertices | dstvertices