Viewer Commands
Commands to a viewer can be entered in the console window. The syntax is
viewer [<number>] command,
where <number> specifies the viewer being addressed. The value 0 refers
to the main viewer and may be omitted for convenience.
Commands:
viewer [<number>] snapshot [-offscreen [<width> <height>]] <filename>
This command takes a snapshot of the current scene and saves it
under the specific filename. The image format will be automatically
determined by the extension of the file name. The list of available
formats includes: TIFF (.tif,.tiff), SGI-RGB (.rgb,.sgi,.bw), JPEG (.jpg,.jpeg), PNM (.pgm,.ppm),
BMP (.bmp), PNG (.png), and Encapsulated PostScript
(.eps). If the viewer number is not given, the snapshot is
taken from all viewers, if you have selected the 2 or 4 viewer
layout from the View menu.
If the -offscreen option is specified, offscreen rendering with a
maximum size of 2048x2048 is used. In this case the viewer number
is required even if viewer 0 is addressed. If the width and
height is not specified explicitly, the size of the image is the
current size of the viewer.
Caution: If you have more than one transparent object
visible in the viewer and you want to use offscreen rendering
set the transparency mode to Blend Delayed and check to see
if all objects are rendered properly prior to taking a snapshot.
viewer [<number>] setPosition <x> <y>
Sets the position of the viewer window relative to the upper left
corner of the screen. The allowed range of x and y
values is defined by the resolution of the screen. Typically this
will be 1280 x 1024.
viewer [<number>] getPosition
Returns the position of the viewer.
viewer [<number>] setSize <width> <height>
Sets the size of the viewer window. The visible part of the 3D
window exactly matches the given size if decorations are switched
off (see below).
viewer [<number>] setVideoFormat pal|ntsc
Sets the size of the viewer window according to PAL 601 or NTSC 601
resolution, i.e., 720x576 pixels or 720x486 pixels. The current
setting of the decoration is taken into account.
viewer [<number>] setVideoFrame <state>
If state is 1, a frame is displayed in the overlay plane of
the viewer. This frame depicts the area where images recorded to
video are safely shown on video players. Setting state to 0
switches the frame off. Note: Objects displayed in the overlay
planes are not saved to file with the snapshot command (see
above).
viewer [<number>] getSize
Returns the size of the viewer window.
viewer [<number>] getCamera
This command returns the current camera settings, i.e., camera
position, camera orientation, and camera focal distance. The values
are returned as Amira commands, which can be executed in order to
restore the camera settings.
viewer [<number>] setCameraPosition <x> <y> <z>
Defines the position of the camera in world coordinates.
viewer [<number>] setCameraOrientation <x> <y> <z> <a>
Defines the orientation of the camera. By default, the camera looks
in negative z-direction with the y-axis pointing upwards. Any
other orientation may be specified as a rotation relative to the
default direction. The rotation is specified by a rotation axis
x y z followed by a rotation angle a (in radians).
viewer [<number>] setCameraFocalDistance
Defines the camera's focal distance. The focal distance is used
to compute the center around which the scene is rotated in
interactive viewing mode.
viewer [<number>] setAutoRedraw <state>
If state is 0, the auto redraw mode is switched off. In this
case the image displayed in the viewer window will not be updated,
unless a redraw command is sent. If state is 1, the auto
redraw mode is switched on again. In a script it might be useful to
disable the auto redraw mode temporarily.
viewer [<number>] redraw
This command forces the current scene to be redrawn. An explicit
redraw is only necessary if the auto redraw mode has been
disabled.
viewer [<number>] rotate <degrees> [x|y|z|m|u|v]
Rotates the camera around an axis. The axis to be taken is specified
by the second argument. The following choices are available.
- x
the x-axis (1,0,0)
- y
the y-axis (0,1,0)
- z
the z-axis (0,0,1)
- m
the most vertical axis of x, y, or z
- u
the viewer's up direction
- v
the view direction
The last option does the same as the rotate button of the user
interface. In most cases the m option is most adequate.
For backward-compatibility the defualt is u.
viewer [<number>] decoration <state>
The decoration is an extended window frame that serves as a
user-interface. It contains buttons and thumb wheels for
adjusting the view or switching between interaction and viewing
mode. The decoration command can be used to show or hide
the decoration area. Hiding the decoration is useful when multiple
viewers are open and the size of a single viewing window is rather
small.
viewer [<number>] setBackgroundColor <r> <g> <b>
This command sets the color of the background to a specific value.
The color may be specified either as a triple of integer RGB values
in the range 0...255, as a triple of rational RGB values in the
range 0.0...1.0, or simply as plain text, e.g. white, where
the list of allowed color names is defined in /usr/lib/X11/rgb.txt.
viewer [<number>] setBackgroundColor2 <r> <g> <b>
Sets the secondary background color which is used by non-uniform
background modes.
viewer setBackgroundMode <mode>
Allows you to specify different background patterns. If mode is set
to 0 a uniform background will be displayed. Mode 1 denotes a
gradient background, while mode 2 causes a checkerboard pattern to
be displayed. This might help to understand the shape of
transparent objects.
viewer setBackgroundImage <imagefile>
This command allows you to place an arbitrary raster image into the
center of the viewer's background. The image must not be larger
than the viewer window itself. The format of the image file will
be detected automatically by looking at the file name extension.
All formats mention for the snapshot command are supported
except of Encapsulated Postscript.
viewer [<number>] saveScene <filename>
Saves all of the geometry displayed in a viewer in Open Inventor 3D
graphics format. Warning: Since many Amira modules use custom
Inventor nodes, the scene usually can not be displayed correctly in
external programs like ivview.
viewer [<number>] viewAll
Resets the camera so that the whole scene becomes visible. This
method is called automatically for the first object being displayed
in a viewer.
viewer [<number>] show
This command opens the specified viewer and ensures that the
viewer window is displayed on top of all other windows on the screen.
viewer [<number>] hide
This command closes the specified viewer.
viewer [<number>] setTransparencyType <type>
This command defines the strategy used for rendering transparent
objects. The argument type may be a number between 0 and 6,
corresponding to the entries Screen Door, Add, Add
Delay, Add Sorted, Blend, Blend Delay, and Blend Sorted as described for the View menu.
Most accurate results are obtained using mode 6, which is the
default. However, some objects may not be recognized correctly as
being transparent. In this case you may switch them off and on
again in order to force them to be rendered last. Also, if lines
are to be rendered on a transparent background problems may occur.
In this case, you may use transparency mode 4 and ensure
the correct rendering order manually.
viewer [<number>] getTransparencyType
This command returns the current transparency type as a number in
the range 0...6. The meaning of this number is the same as in
setTransparencyType.
viewer [<number>] fogRange <min> <max>
Sets a range of attenuation for the fog affect that can be
introduced into a viewer scene by the View menu.
The default range is
. Values within this range correspond
to distances of scene points from the camera, such that points
nearest to the camera have value zero and those farthest away
have value one. Restricting the range of attenuation means that
attenuation will start at points where the specified minimum is
attained and reach its maximum at points where the specified
maximum is attained. Maximum attenuation by fog is equivalent to
invisibility, thus all points beyond that maximum will appear
as background.
Back (3.1.6 Viewer Window)
Next (3.1.7 Console Window)
Home