Viewport object

A viewport is the container for the graphics generated by the application. TheViewport object stores the various settings that determine how objects are displayed within that viewport.

The following topics are discussed:

Access

session.viewports[name]

Viewport(...)

This method creates a Viewport object with the specified origin and dimensions.

Path

session.Viewport

Required arguments

name

A String specifying the repository key.

Optional arguments

origin

A pair of Floats specifying the X- and Y-coordinates in millimeters in the canvas coordinate system of the lower left corner of the viewport. The default origin is (0, 0).

width

A Float specifying the width in millimeters of the viewport. Possible values are 30   width    (maxWidth). The default value is 120.0.

Note:

The maximum value of width (maxWidth) is the width of the screen in millimeters.

height

A Float specifying the height in millimeters of the viewport. This height includes the title bar. Possible values are 30   height    (maxHeight). The default value is 80.0.

Note:

The maximum value of height (maxHeight) is the height of the screen in millimeters.

border

A Boolean specifying whether the viewport border is visible in a printed image. The default value is ON.

titleBar

A Boolean specifying whether the viewport title should be displayed in a printed image. The default value is ON.

If border = OFF, the title will not be visible, even if titleBar =ON.

titleStyle

A SymbolicConstant specifying which title to use for the viewport title. Possible values are CUSTOM and SYSTEM. The default value is SYSTEM.

If titleStyle = CUSTOM, customTitleString will be used. If titleStyle= SYSTEM, a system-generated string will be used.

customTitleString

A String specifying the viewport title when titleStyle =CUSTOM. The default value is an empty string.

Return value

A Viewport object.

Exceptions

RangeError.

If the user attempts to delete the only viewport:

SystemError: the current viewport may not be deleted.

If width is out of range:

RangeError: width must be a Float in the range: 30 <= width <= maxWidth

If height is out of range:

RangeError: height must be a Float in the range: 30 <= width <= maxHeight

bringToFront()

This method moves the Viewport object to the front.

Arguments

None.

Return value

None.

Exceptions

None.

disableMultipleColors()

This method disables applying multiple color mappings that was enabled using enableMultipleColors

Arguments

None.

Return value

None.

Exceptions

None.

disableRefresh()

This method disables Viewport refresh. Some methods that require the Viewport to be up-to-date will override this setting. It is advisable to use this method sparingly.

Arguments

None.

Return value

None.

Exceptions

None.

disableColorCodeUpdates()

This method disables Viewport updates and internal computations triggered because of color coding. Performance improvement will be significant when color coding is ON and repeating operations are performed using a script each of which requires color code updates. No benefit will be had when color coding is OFF.

Arguments

None.

Return value

None.

Exceptions

None.

enableMultipleColors()

This method enables multiple color mappings to be applied at the same time. It also ensures that the Viewport is updated correctly when initialColor is set.

Arguments

None.

Return value

None.

Exceptions

None.

enableRefresh()

This method enables Viewport refresh disabled using disableRefresh.

Arguments

None.

Return value

None.

Exceptions

None.

enableColorCodeUpdates()

This method enables Viewport color code updates disabled using disableColorCodeUpdates.

Arguments

None.

Return value

None.

Exceptions

None.

getActiveElementLabels(...)

This method returns the element labels currently active in the viewport based on the current display group and optionally based on any active cut if useCut is True. The labels will optionally be printed to the replay file if printResults is True. The getActiveElementLabels method has the following arguments:

Required arguments

None.

Optional arguments

useCut

A Boolean flag to specify if any active cutting plane is to be considered in determining active elements.

printResults

A Boolean flag to specify if the active element labels are to be printed to the replay file.

Return value

A Dictionary object of labels for each active part instance.

Exceptions

None.

getActiveNodeLabels(...)

This method returns the node labels currently active in the viewport based on the current display group and optionally based on any active cut if useCut is True. The labels will optionally be printed to the replay file ifprintResults is True. The getActiveNodeLabels method has the following arguments:

Required arguments

None.

Optional arguments

useCut

A Boolean flag to specify if any active cutting plane is to be considered in determining active nodes.

printResults

A Boolean flag to specify if the active node labels are to be printed to the replay file.

Return value

A Dictionary object of labels for each active part instance.

Exceptions

None.

getPrimVarMinMaxLoc()

This method returns a dictionary containing the minimum, maximum and their location for the current primary variable. A contour plot should be displayed in the current viewport or else the method will return None.

Arguments

None.

Return value

A dictionary with keys 'minPartInstanceName', 'minElementLabel', 'minNodeLabel', 'minPosition', 'maxPartInstanceName', 'maxElementLabel', 'maxNodeLabel', 'maxPosition'

Exceptions

None.

makeCurrent()

This method makes theViewport object the current viewport.

Arguments

None.

Return value

None.

Exceptions

None.

maximize()

This method maximizes the Viewport object to fill the drawing area.

Arguments

None.

Return value

None.

Exceptions

None.

minimize()

This method minimizes the Viewport object to appear as an abbreviated title bar.

Arguments

None.

Return value

None.

Exceptions

None.

offset(...)

This method modifies the current X-Y location of the viewport by the specified distance.

Required arguments

None.

Optional arguments

deltaX

A Float specifying the offset in millimeters of the X-component of the viewport origin. The default value is 0.

deltaY

A Float specifying the offset in millimeters of the Y-component of the viewport origin. The default value is 0.

Return value

None.

Exceptions

None.

restore()

This method restores a maximized or minimized Viewport object to its previous size and location.

Arguments

None.

Return value

None.

Exceptions

None.

sendToBack()

This method moves the Viewport object to the back.

Arguments

None.

Return value

None.

Exceptions

None.

setColor(...)

This method specifies the color assignment using initialColor and translucency. If initialColor has a value of 'As is', translucency has no effect. The setColor method has the following arguments:

Required arguments

initialColor

A string specifying the initial color applied to the objects.

Optional arguments

translucency

A float in the range of 0.0 to 1.0 specifying how translucent the objects drawn using initialColor needs to be.

Return value

None.

Exceptions

None.

setColor(...)

This method specifies the color assignment using attributes specified by an AttributeColorMap object. The setColor method has the following arguments:

Required arguments

colorMapping

An AttributeColorMap object. Possible values are any AttributeColorMap object.

Optional arguments

None.

Return value

None.

Exceptions

None.

setColor(...)

This method specifies the color of a Leaf object.

Required arguments

leaf

A Leaf object. Possible values are any Leaf object.

Optional arguments

At least one of the following must be provided:

edgeColorWireHide

A String specifying the color to be used for drawing the edges of the elements contained in leaf when the render style is wireframe or hidden.

edgeColorFillShade

A String specifying the color to be used for drawing the edges of the elements contained in leaf when the render style is filled or shaded.

fillColor

A String specifying the color to be used for drawing the faces of the elements contained in leaf when the render style is filled or shaded.

nodeSymbolColor

A String specifying the color to be used for drawing the nodes contained in leaf.

nodeSymbolType

A SymbolicConstant specifying the node symbol types for the nodes contained in leaf. Possible values areFILLED_CIRCLE, FILLED_SQUARE, FILLED_DIAMOND, FILLED_TRI, HOLLOW_CIRCLE, HOLLOW_SQUARE, HOLLOW_DIAMOND, HOLLOW_TRI, CROSS, and XMARKER. The default value is HOLLOW_CIRCLE.

nodeSymbolSize

A SymbolicConstant specifying the node symbol size for the nodes contained in leaf. Possible values are SMALL, MEDIUM, and LARGE. The default value is SMALL.

Return value

None.

Exceptions

None.

forceRefresh()

This method causes the Viewport to refresh immediately. It is provided to allow scripts to refresh the Viewport before the script terminates. Normally, there would only be a single cumulative refresh that takes place immediately after the script completes.

Arguments

None.

Return value

None.

Exceptions

None.

setValues(...)

This method modifies the Viewport object. The arguments to setValues are the same as the arguments to the Viewport method, except for the name argument. In addition, the setValues method has the following arguments:

Required arguments

None.

Optional arguments

displayedObject

A Displayable object specifying the object to be displayed. The Displayable type is an abstract generalization. The concrete possible types are Part, Assembly, ConstrainedSketch, Odb, PlyStackPlot, or XYPlot. If displayedObject=None, Abaqus displays an empty viewport.

displayMode

A SymbolicConstant specifying the display mode of the viewport. Possible values are:

  • SINGLE, specifying a single displayedObject.

  • OVERLAY, specifying one or more layers to be displayed simultaneously—each layer contains one displayedObject.

visibleLayers

A sequence of Strings specifying the names of layers that will be displayed in the viewport when displayMode = OVERLAY.

viewManipLayers

A SymbolicConstant specifying which layer or layers will be controlled by the view manipulation tools when displayMode=OVERLAY. Possible values are ALL and CURRENT.

currentLayer

A String specifying which layer is affected by options settings when displayMode =OVERLAY. The current layer is also the only layer affected by view manipulations whenviewManipLayers =CURRENT.

layerOffset

A Float specifying a factor to be used in offsetting layers in the screen Z direction. Possible values are –1 to 1. A negative value reverses the apparent order in which the layers are plotted.

Return value

None.

Exceptions

RangeError.

addDrawings(...)

This method identifies the names of Drawing objects to be rendered in the Viewport.

Required arguments

None.

Optional arguments

names

A sequence of String values identifying keys in the session.drawings repository.

Return value

None.

Exceptions

ValueError.

removeDrawings(...)

This method identifies the names of Drawing objects to no longer be rendered in the Viewport.

Required arguments

None.

Optional arguments

names

A sequence of String values identifying keys in the Viewport sequence.

Return value

None.

Exceptions

ValueError.

timeDisplay(...)

This method refreshes the Viewport display numFrames times and then checks to see if numSeconds seconds have elapsed. If not, it will continue refreshing the Viewport until the time has elapsed. At completion, the actual number of refreshes (frames) rendered and elapsed time will be reported along with the calculated frames-per-second (fps).

Required arguments

None.

Optional arguments

numFrames

An Int specifying the minimum number of times to refresh the Viewport. The default value is 0.

numSeconds

An Int specifying the minimum number of seconds to spend refreshing the Viewport. The default value is 10.

degreesPerFrame

A Float specifying the number of degrees to rotate the model view about its Z axis before each refresh. The default value is 0.0.

Return value

None.

Exceptions

None.

Members

The Viewport object has members with the same names and descriptions as the arguments to the Viewport method.

In addition, the Viewport object can have the following members:

displayMode

A SymbolicConstant specifying the display mode of the viewport. Possible values are:

  • SINGLE, specifying a single displayedObject.

  • OVERLAY, specifying one or more layers to be displayed simultaneously—each layer contains one displayedObject.

viewManipLayers

A SymbolicConstant specifying which layer or layers will be controlled by the view manipulation tools when displayMode=OVERLAY. Possible values are ALL and CURRENT.

layerOffset

A Float specifying a factor to be used in offsetting layers in the screen Z direction. Possible values are –1 to 1. A negative value reverses the apparent order in which the layers are plotted.

windowState

A SymbolicConstant specifying the current state of a viewport. Possible values are NORMAL, MAXIMIZED, and MINIMIZED.

currentWidth

A Float specifying the width in millimeters of the current viewport, regardless of the value of windowState.

currentHeight

A Float specifying the height in millimeters of the current viewport, regardless of the value of windowState, and including the title bar.

applyLinkedCommands

A Boolean specifying whether the viewport is linked for synchronization. The default value is ON.

activeColorModes

A SymbolicConstant specifying the currently active color mappings. Possible values are:

  • DEFAULT_COLORS

  • PART_GEOM_MAP_COLORS

  • ASSEMBLY_MAP_COLORS

  • PART_MAP_COLORS

  • INSTANCE_MAP_COLORS

  • INSTANCE_TYPE_MAP_COLORS

  • SECTION_MAP_COLORS

  • MATERIAL_MAP_COLORS

  • LOAD_MAP_COLORS

  • BC_MAP_COLORS

  • INTERACTION_MAP_COLORS

  • CONSTRAINT_MAP_COLORS

  • SET_MAP_COLORS

  • SURFACE_MAP_COLORS

  • INTERNAL_SET_MAP_COLORS

  • INTERNAL_SURFACE_MAP_COLORS

  • DISPLAY_GRP_MAP_COLORS

  • SELECTION_GRP_MAP_COLORS

  • ELTYPE_MAP_COLORS

  • PLOT_MAP_COLORS

  • MESH_MAP_COLORS

The default value is DEFAULT_COLORS.

colorMode

A SymbolicConstant specifying the last applied color mapping. Possible values are:

  • DEFAULT_COLORS

  • PART_GEOM_MAP_COLORS

  • ASSEMBLY_MAP_COLORS

  • PART_MAP_COLORS

  • INSTANCE_MAP_COLORS

  • INSTANCE_TYPE_MAP_COLORS

  • SECTION_MAP_COLORS

  • MATERIAL_MAP_COLORS

  • LOAD_MAP_COLORS

  • BC_MAP_COLORS

  • INTERACTION_MAP_COLORS

  • CONSTRAINT_MAP_COLORS

  • SET_MAP_COLORS

  • SURFACE_MAP_COLORS

  • INTERNAL_SET_MAP_COLORS

  • INTERNAL_SURFACE_MAP_COLORS

  • DISPLAY_GRP_MAP_COLORS

  • SELECTION_GRP_MAP_COLORS

  • ELTYPE_MAP_COLORS

  • PLOT_MAP_COLORS

  • MESH_MAP_COLORS

The default value is DEFAULT_COLORS.

translucency

A Float specifying the translucency that will be applied to objects colored using initialColor and it needs to be set along with initialColor. If initialColor is set to 'As is' then translucency will have no effect.

animationConnect

A Boolean specifying whether an animation is connected to the viewport.

colorMappings

A repository of AttributeColorMap objects specifying the objects cannot be constructed but the following attribute maps are supported:

  • "type"

  • "Element set"

  • "Material"

  • "Section"

  • "Default"

  • "Part"

  • "Part instance"

  • "Element type"

  • "Averaging region"

  • "Assembly"

  • "Property"

  • "Set"

  • "Surface"

  • "Skin"

  • "Profile"

  • "Part shape"

  • "Part status"

  • "Part geometry"

  • "Meshability"

  • "Instance type"

  • "Load"

  • "Boundary condition"

  • "Interaction"

  • "Constraint"

  • "Interaction type"

  • "Constraint type"

  • "Display group"

  • "Selection group"

  • "Interaction property"

  • "Connector"

  • "Connector type"

  • "Connector property"

  • "Internal set"

  • "Internal surface"

  • "mapColors"

  • "autoColors"

  • "overrides"

  • "defaultAutoColors"

  • "defaultOverrides"

  • "objectToCopy"

  • "colorMapping"

  • "colorMappings"

  • "colorMode"

  • "attributeColors"

  • "updateOverrides"

  • "colorCodeOverride"

  • "initialColor"

  • "Layup"

  • "Ply"

initialColor

A String specifying the color that will be applied to all objects in the viewport at the start of color coding. The possible values are 'As is', 'Default' or a string with a hexadecimal representation of a color.

currentLayer

A String specifying which layer is affected by options settings when displayMode =OVERLAY. The current layer is also the only layer affected by view manipulations whenviewManipLayers =CURRENT.

displayedObject

A Displayable object specifying the object to be displayed. The Displayable type is an abstract generalization. The concrete possible types are Part, Assembly, ConstrainedSketch, Odb, PlyStackPlot, or XYPlot. If displayedObject=None, Abaqus displays an empty viewport.

layers

A repository of Layer objects specifying the key to the repository is a String with the name of the layer.

view

A View object specifying the object that controls viewing of the viewport content.

odbDisplay

An OdbDisplay object specifying the display options for the Odb object.

partDisplay

A PartDisplayOptions object specifying the display options for the Part object.

assemblyDisplay

An AssemblyDisplayOptions object specifying the display options for the Assembly object.

viewportAnnotationOptions

A ViewportAnnotationOptions object.

detailPlotOptions

A DetailPlotOptions object.

annotationsToPlot

An AnnotationsToPlotArray object.

visibleLayers

A tuple of Strings specifying the names of layers that will be displayed in the viewport when displayMode = OVERLAY.

currentOrigin

A pair of Floats specifying the X- and Y-coordinates in millimeters in the canvas coordinate system of the lower left corner of the current viewport, regardless of the value of windowState.

iconOrigin

A pair of Floats specifying the X- and Y-coordinates in millimeters of the lower left corner of the current viewport from a coordinate system having its origin in the lower left corner of the drawing area. This origin refers to the viewport location when windowState =MINIMIZED.

lightOptions

A LightOptions object.

imageOptions

An ImageOptions object.

movieOptions

A MovieOptions object.

drawings

A tuple of Strings specifying keys to the session.drawings repository. The default value is an empty sequence.