Oasys.D3PLOT.GraphicsWindow class¶
Constants¶
model offset¶
up vector¶
Properties¶
- property GraphicsWindow.active: boolean¶
Whether the graphics window is active or not (equivalent to turning the window off/on in the GUI)
- property GraphicsWindow.models(read only): integer¶
The total number of models in this graphics window
- property GraphicsWindow.number(read only): integer¶
The graphics window number
- property GraphicsWindow.state: integer¶
The current state displayed in this graphics window. Also see the Model
state
- property GraphicsWindow.states(read only): integer¶
The highest state number from all models in this graphics window
Constructor¶
- classmethod GraphicsWindow(*model)¶
Creates a new graphics window in D3PLOT
- Parameters:
model (Model object) – The model to open in this graphics window This argument can be repeated if required. Alternatively a single array argument containing the multiple values can be given
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To create a graphics window containing
Modelm in D3PLOTgw = Oasys.D3PLOT.GraphicsWindow(m)
Static methods¶
- classmethod GraphicsWindow.First()¶
Returns the GraphicsWindow object for the first graphics window in D3PLOT (or None if there are no graphics windows)
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To get the GraphicsWindow object for the first graphics window:
gw = Oasys.D3PLOT.GraphicsWindow.First()
- classmethod GraphicsWindow.GetFromID(graphics_window_number)¶
Returns the GraphicsWindow object for a graphics window ID (or None if graphics window does not exist)
- Parameters:
graphics_window_number (integer) – number of the graphics window you want the GraphicsWindow object for
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To get the GraphicsWindow object for graphics window number 1
gw = Oasys.D3PLOT.GraphicsWindow.GetFromID(1)
- classmethod GraphicsWindow.Last()¶
Returns the GraphicsWindow object for the last graphics window in D3PLOT (or None if there are no graphics windows)
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To get the GraphicsWindow object for the last graphics window:
gw = Oasys.D3PLOT.GraphicsWindow.Last()
- classmethod GraphicsWindow.Total()¶
Returns the total number of graphics windows in use in D3PLOT
- Returns:
Total number of graphics windows
- Return type:
integer
Example
To get total number of graphics windows:
total = Oasys.D3PLOT.GraphicsWindow.Total()
Instance methods¶
- GraphicsWindow.AddModel(model)¶
Adds a model to a graphics window
- Parameters:
model (Model object) – The model to add to the graphics window
- Returns:
No return value
- Return type:
None
Example
To add model m to graphics window gw in D3PLOT
gw.AddModel(m)
- GraphicsWindow.Delete()¶
Deletes a graphics window in D3PLOT
Do not use the GraphicsWindow object after calling this method
- Returns:
No return value
- Return type:
None
Example
To delete graphics window gw in D3PLOT
gw.Delete()
- GraphicsWindow.GetModelInfo(index)¶
Gets the information for a model in a graphics window
- Parameters:
index (integer) – index of the model in the graphics window you want information for (0 <= index <
models)- Returns:
Dict with properties
- colour:
(
Colour) The colour for the model- mode:
(constant) How the model is model is displayed in the graphics window. One of
View.WIRE,View.HIDDEN,View.SHADEDorView.CURRENT- model:
(Model object) The model at the given index
- offsetMode:
(constant) How the model is offset in the graphics window. One of
GraphicsWindow.NO_OFFSET,GraphicsWindow.OFFSET_MODEL_SPACEorGraphicsWindow.OFFSET_SCREEN_SPACE- state:
(integer) The current state number for the model
- visible:
(boolean) Whether the model is visible in the graphics window or not
- xOffset:
(float) The X offset for the model
- yOffset:
(float) The Y offset for the model
- zOffset:
(float) The Z offset for the model
- Return type:
dict
Example
To get the information for the second model in graphics window gw:
info = gw.GetModelInfo(1)
- GraphicsWindow.GetTargetEye()¶
Get the current target and eye settings
- Returns:
Dict with properties
- eye:
(list) List containing the coordinates of the eye position
- perspective:
(boolean) Whether the perspective switch is active
- scale:
(float) Scale factor
- target:
(list) List containing the coordinates of the target position
- up:
(constant/list)
GraphicsWindow.UP_AUTOMATIC,GraphicsWindow.UP_X,GraphicsWindow.UP_Y,GraphicsWindow.UP_Zor a list containing the up vector if user defined- Return type:
dict
Example
To get the current target and eye information for graphics window gw:
info = gw.GetTargetEye()
- GraphicsWindow.Next()¶
Returns the next graphics window (or None if there is not one)
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To get the graphics window after graphics window gw:
gw = gw.Next()
- GraphicsWindow.Previous()¶
Returns the previous graphics window (or None if there is not one)
- Returns:
GraphicsWindow object
- Return type:
GraphicsWindow
Example
To get the graphics window before graphics window gw:
gw = gw.Previous()
- GraphicsWindow.Redraw()¶
Redraws the graphics window
- Returns:
No return value
- Return type:
None
Example
To dedraw graphics window gw:
gw.Redraw()
- GraphicsWindow.RemoveModel(model)¶
Removes a model from a graphics window
- Parameters:
model (Model object) – The model to remove from the graphics window
- Returns:
No return value
- Return type:
None
Example
To remove model m from graphics window gw in D3PLOT
gw.RemoveModel(m)
- GraphicsWindow.SetModelInfo(index, info)¶
Sets the information for a model in a graphics window
- Parameters:
index (integer) – index of the model in the graphics window you want to set information for (0 <= index <
models)info (dict) –
Dictionary containing the information to set. Can be any of:
- colour:
(
Colour) The colour for the model- mode:
(constant) How the model is model is displayed in the graphics window. One of
View.WIRE,View.HIDDEN,View.SHADEDorView.CURRENT- offsetMode:
(constant) How the model is offset in the graphics window. One of
GraphicsWindow.NO_OFFSET,GraphicsWindow.OFFSET_MODEL_SPACEorGraphicsWindow.OFFSET_SCREEN_SPACE- visible:
(boolean) Whether the model is visible in the graphics window or not
- xOffset:
(float) The X offset for the model
- yOffset:
(float) The Y offset for the model
- zOffset:
(float) The Z offset for the model
- Returns:
No return value
- Return type:
None
Example
To set the second model in graphics window gw to have an offset of (100, 100, 0) in model space:
gw.SetModelInfo(1, { offsetMode: Oasys.D3PLOT.GraphicsWindow.OFFSET_MODEL_SPACE, xOffset: 100, yOffset:100, zOffset: 0 } )
- GraphicsWindow.SetTargetEye(info)¶
Set the current target and eye settings
- Parameters:
info (dict) –
Dictionary containing the target and eye properties
- eye:
(list) List containing the coordinates of the eye position
- perspective:
(boolean) Whether the perspective switch is active. If omitted the default is true
- scale:
(float) Scale factor. If omitted, the scaling is automatically calculated (in the same way as if running D3PLOT interactively)
- target:
(list) List containing the coordinates of the target position
- up:
(constant/list)
GraphicsWindow.UP_AUTOMATIC,GraphicsWindow.UP_X,GraphicsWindow.UP_Y,GraphicsWindow.UP_Zor a list containing the up vector if user defined. If omitted the default isGraphicsWindow.UP_AUTOMATIC- Returns:
No return value
- Return type:
None
Example
To set the eye position to (-2365.1, -373.2, 1081.1) looking at target (-2075.9, -367.7, 905.2) with the up vector in global Z, automatically turning on perspective and calculating the scale factor, in graphics window gw:
gw.SetTargetEye( { eye: [ 1000, 0, 0], target: [0, 0, 0], up: Oasys.D3PLOT.GraphicsWindow.UP_Z } )To set the eye position to (-2365.1, -373.2, 1081.1) looking at target (-2075.9, -367.7, 905.2) with the up vector in global Z, turning off perspective and setting the scale factor to 10, in graphics window gw:
gw.SetTargetEye( { eye: [ 1000, 0, 0], target: [0, 0, 0], up: Oasys.D3PLOT.GraphicsWindow.UP_Z, perspective: false, scale: 10 } )