The GraphicsWindow class gives you access to graphics windows in D3PLOT. More...
The D3PLOT JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Type | Description |
| active | boolean | Whether the graphics window is active or not (equivalent to turning the window off/on in the GUI) |
| models (read only) | integer | The total number of models in this graphics window |
| number (read only) | integer | The graphics window number |
| state | integer | The current state displayed in this graphics window. Also see the Model state. |
| states (read only) | integer | The highest state number from all models in this graphics window |
Constructornew GraphicsWindow(model[Model object])DescriptionCreates a new graphics window in D3PLOT |
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
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo create a graphics window containing Model m in D3PLOT var gw = new GraphicsWindow(m);
|
Details of functionsAddModel(model[Model object])DescriptionAdds a model to a graphics window |
The model to add to the graphics window
ReturnsNo return value |
ExampleTo add model m to graphics window gw in D3PLOT gw.AddModel(m);
|
Delete()DescriptionDeletes a graphics window in D3PLOT |
No arguments
ReturnsNo return value |
ExampleTo delete graphics window gw in D3PLOT gw.Delete();
|
First() [static]DescriptionReturns the GraphicsWindow object for the first graphics window in D3PLOT (or null if there are no graphics windows) |
No arguments
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo get the GraphicsWindow object for the first graphics window: var gw = GraphicsWindow.First();
|
GetFromID(graphics window number[integer]) [static]DescriptionReturns the GraphicsWindow object for a graphics window ID (or null if graphics window does not exist) |
number of the graphics window you want the GraphicsWindow object for
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo get the GraphicsWindow object for graphics window number 1 var gw = GraphicsWindow.GetFromID(1);
|
GetModelInfo(index[integer])DescriptionGets the information for a model in a graphics window |
index of the model in the graphics window you want information for (0 <= index < models)
Returns |
Object with the following properties:
| Name | Type | Description |
| 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.SHADED or View.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_SPACE or GraphicsWindow.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 | real | The X offset for the model |
| yOffset | real | The Y offset for the model |
| zOffset | real | The Z offset for the model |
object
ExampleTo get the information for the second model in graphics window gw: var info = gw.GetModelInfo(1);
|
GetTargetEye()DescriptionGet the current target and eye settings |
No arguments
Returns |
Object with the following properties:
| Name | Type | Description |
| eye | array | Array containing the coordinates of the eye position |
| perspective | boolean | Whether the perspective switch is active |
| scale | real | Scale factor |
| target | array | Array containing the coordinates of the target position |
| up | constant/array | GraphicsWindow.UP_AUTOMATIC, GraphicsWindow.UP_X, GraphicsWindow.UP_Y, GraphicsWindow.UP_Z or an array containing the up vector if user defined |
object
ExampleTo get the current target and eye information for graphics window gw: var info = gw.GetTargetEye();
|
Last() [static]DescriptionReturns the GraphicsWindow object for the last graphics window in D3PLOT (or null if there are no graphics windows) |
No arguments
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo get the GraphicsWindow object for the last graphics window: var gw = GraphicsWindow.Last();
|
Next()DescriptionReturns the next graphics window (or null if there is not one) |
No arguments
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo get the graphics window after graphics window gw: gw = gw.Next();
|
Previous()DescriptionReturns the previous graphics window (or null if there is not one) |
No arguments
ReturnsGraphicsWindow object Return typeGraphicsWindow |
ExampleTo get the graphics window before graphics window gw: gw = gw.Previous();
|
Redraw()DescriptionRedraws the graphics window |
No arguments
ReturnsNo return value |
ExampleTo dedraw graphics window gw: gw.Redraw();
|
RemoveModel(model[Model object])DescriptionRemoves a model from a graphics window |
The model to remove from the graphics window
ReturnsNo return value |
ExampleTo remove model m from graphics window gw in D3PLOT gw.RemoveModel(m);
|
SetModelInfo(index[integer], info[object])DescriptionSets the information for a model in a graphics window |
index of the model in the graphics window you want to set information for (0 <= index < models)
Object containing the information to set. Can be any of:
Object has the following properties:
| Name | Type | Description |
| 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.SHADED or View.CURRENT |
| offsetMode | constant | How the model is offset in the graphics window. One of GraphicsWindow.NO_OFFSET, GraphicsWindow.OFFSET_MODEL_SPACE or GraphicsWindow.OFFSET_SCREEN_SPACE |
| visible | boolean | Whether the model is visible in the graphics window or not |
| xOffset | real | The X offset for the model |
| yOffset | real | The Y offset for the model |
| zOffset | real | The Z offset for the model |
ReturnsNo return value |
SetTargetEye(info[object])DescriptionSet the current target and eye settings |
Object containing the target and eye properties
Object has the following properties:
| Name | Type | Description |
| eye | array | Array containing the coordinates of the eye position |
| perspective | boolean | Whether the perspective switch is active. If omitted the default is true |
| scale | real | Scale factor. If omitted, the scaling is automatically calculated (in the same way as if running D3PLOT interactively) |
| target | array | Array containing the coordinates of the target position |
| up | constant/array | GraphicsWindow.UP_AUTOMATIC, GraphicsWindow.UP_X, GraphicsWindow.UP_Y, GraphicsWindow.UP_Z or an array containing the up vector if user defined. If omitted the default is GraphicsWindow.UP_AUTOMATIC |
ReturnsNo return value |
Total() [static]DescriptionReturns the total number of graphics windows in use in D3PLOT |
No arguments
ReturnsTotal number of graphics windows Return typeinteger |
ExampleTo get total number of graphics windows: var total = GraphicsWindow.Total();
|