The Measure class allows you to create measurements between nodes and parts. 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 | Description |
| Measure.HIDDEN | Hidden line style for measures |
| Measure.WIREFRAME | Wireframe line style for measures |
| Name | Description |
| Measure.AUTOMATIC | Automatic number format |
| Measure.GENERAL | General number format, for example 123.4 |
| Measure.SCIENTIFIC | Scientific number format, for example, 1.234E+2 |
| Name | Description |
| Measure.DEFORM | Consider Deform (Shift deform, Magnify etc.) coordinates for measure calculations |
| Measure.MODEL_SPACE | Consider model space offsets in the graphics window |
| Name | Description |
| Measure.SHOW_ALL | Show all measures |
| Measure.SHOW_CURRENT | Show only the current measure |
| Measure.SHOW_NONE | Show no measure |
| Name | Type | Description |
| consider_blanking | logical | true if calculations in Measure.Data() only consider unblanked elements, false (default) if they consider all elements. |
| current | integer | Index of the measure currently selected for display purposes, starting at 1. |
| display | constant | Display options for measurements. Can be any combination (bitwise OR) of Measure.MAGNITUDE, Measure.VECTOR, Measure.LABEL and Measure.TRANSPARENT. |
| format | constant | Number format for measures. Can be Measure.AUTOMATIC, Measure.SCIENTIFIC or Measure.GENERAL. |
| line | constant | Line style for measures. Can be Measure.HIDDEN or Measure.WIREFRAME. |
| offsets | constant | Whether or not to consider Deform (Shift deform, Magnify etc.) or model space offsets in the calculation of measures. Can be any combination (bitwise OR) of Measure.DEFORM, Measure.MODEL_SPACE. |
| precision | integer | Number of decimal places for scientific or general number format. |
| show | constant | Whether all, only the current or no measure is shown. Can be Measure.SHOW_NONE, Measure.SHOW_CURRENT or Measure.SHOW_ALL. |
| total (read only) | integer | Total number of measures in D3PLOT |
| Name | Type | Description |
| index (read only) | integer | Index where the measure appears on the interactive measure menu, starting at 1. Note that the index of a measure can change when measures with lower indices are deleted. |
| name | string | Measure name |
| type (read only) | constant | Measure type. Can be Measure.NODE_TO_NODE, Measure.NODE_ANGLE, Measure.NODE_ORIGIN, Measure.NODE_TO_PART or Measure.PART_TO_PART. |
Detailed DescriptionThe Measure class allows you to measure distances and angles between nodes and/or parts. The following example shows how Measures are used to get the distance between two parts. |
// Create a measure between the 11th part and 12th part in the model:
var m = new Measure(Measure.PART_TO_PART, { part1: 11, part2: 12});
// Get the distace between these parts at state 10:
SetCurrentState(10);
var data = m.Data();
var distance = data.mag;
// Show all measurements on the screen in state 20:
// Note that SetCurrentState would only affect model data handling, but
// here we are interested in the state on the screen, so we set it with
// SetWindowFrame instead.
SetWindowFrame(ALL, 20);
Measure.show = Measure.SHOW_ALL;
See the documentation below for more details.
Constructornew Measure(type[constant], options[object])DescriptionCreate a new Measure object. |
Measure type. Can be
Measure.NODE_TO_NODE,
Measure.NODE_ANGLE,
Measure.NODE_ORIGIN,
Measure.NODE_TO_PART or
Measure.PART_TO_PART
Measure options.
Object has the following properties:
| Name | Type | Description |
| model1 | integer | Model ID for the first node or part for the measurement. If omitted, the current model will be used. |
| model2 | integer | Model ID for the second node or part for the measurement. If omitted, the current model will be used. |
| model3 | integer | Model ID for the third node for the measurement. If omitted, the current model will be used. |
| node1 | integer | First node for the measurement. If +ve: internal node number starting at 1 (faster), if -ve: external node label. |
| node2 | integer | Second node for the measurement. If +ve: internal node number starting at 1 (faster), if -ve: external node label. |
| node3 | integer | Third node for the measurement. If +ve: internal node number starting at 1 (faster), if -ve: external node label. |
| part1 | integer | First part for the measurement If +ve: internal part number starting at 1 (faster), if -ve: external part label. |
| part2 | integer | Second part for the measurement. If +ve: internal part number starting at 1 (faster), if -ve: external part label. |
| window | integer | Graphics window ID where the measurement will be created. If omitted, it will be created in the first window. |
ReturnsMeasure object Return typeMeasure |
Details of functionsData()DescriptionReturns an object with data for this measure. |
No arguments
Returns |
Object with the following properties:
| Name | Type | Description |
| dx | real | X component of the measurement (for types Measure.NODE_TO_NODE, Measure.NODE_ORIGIN, Measure.NODE_TO_PART or Measure.PART_TO_PART) |
| dy | real | Y component of the measurement (for types Measure.NODE_TO_NODE, Measure.NODE_ORIGIN, Measure.NODE_TO_PART or Measure.PART_TO_PART) |
| dz | real | Z component of the measurement (for types Measure.NODE_TO_NODE, Measure.NODE_ORIGIN, Measure.NODE_TO_PART or Measure.PART_TO_PART) |
| mag | real | magnitude of the measurement (length for types Measure.NODE_TO_NODE, Measure.NODE_ORIGIN, Measure.NODE_TO_PART or Measure.PART_TO_PART, angle in degrees for type Measure.NODE_ANGLE) |
| xy | real | Angle in the XY plane in degrees for type Measure.NODE_ANGLE |
| xz | real | Angle in the XZ plane in degrees for type Measure.NODE_ANGLE. The zx property is an alternative name for this. |
| yz | real | Angle in the YZ plane in degrees for type Measure.NODE_ANGLE |
| zx | real | Angle in the ZX plane in degrees for type Measure.NODE_ANGLE. The xz property is an alternative name for this. |
object
ExampleTo get the X component of the measure object m:
var data = m.Data();
var dx = data.dx;
|
Delete(type[integer]) [static]DescriptionDeletes the measure with the given index. |
Index of the measure to be deleted, starting at 1.
ReturnsNo return value |
ExampleTo delete measure m:
var index = m.index;
Measure.Delete(index);
|
DeleteAll() [static]DescriptionDeletes all measures. |
No arguments
ReturnsNo return value |
ExampleTo delete all measures:
Measure.DeleteAll();
|
GetFromIndex(type[integer]) [static]DescriptionGets the measure object for a given index. |
Index of the measure, starting at 1.
ReturnsMeasure object for that index Return typeMeasure |
ExampleTo get the object for the measure at index 3:
var m = Measure.GetFromIndex(3);
|