ObjectDistanceMeasurement
Class in @bimworks/viewer3d.
API catalogue · @bimworks/viewer3d · Class
class ObjectDistanceMeasurementInheritance and interfaces#
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | inheritedFrom: Measurement.constructor |
| distance | Method | |
| editable | Method | Whether the points of this measurement can be dragged to a new position after it has been finalized (default true). Supported for area, path and point measur… |
| editable | Method | inheritedFrom: Measurement.editable |
| editState | Method | The point being dragged (see editable): its index, whether it moved yet, and the measurement's value before the drag as its label shows it. Null when no poin… |
| finished | Method | inheritedFrom: Measurement.finished |
| id | Method | Get the unique identifier of this measurement inheritedFrom: Measurement.id |
| mode | Method | |
| pointCount | Method | inheritedFrom: Measurement.pointCount |
| qids | Method | |
| referenceModes | Method | |
| referenceObjects | Method | |
| referenceOn | Method | Whether the measurement goes to the references of its objects: while picking the choice made with preferReference, once finished whether a slot actually uses… |
| references | Method | |
| result | Method | |
| snapsToVertices | Method | inheritedFrom: Measurement.snapsToVertices |
| canCycleReferenceMode | Method | Whether the O key can cycle this measurement's reference modes: it is finished and both objects are known |
| canFinish | Method | inheritedFrom: Measurement.canFinish |
| cycleReferenceMode | Method | Move to the next reference-mode state and recompute (the O key): surface/surface, then B on its reference, both, A alone, skipping states an object without a… |
| getViewFitPoints | Method | inheritedFrom: Measurement.getViewFitPoints |
| isHovered | Method | inheritedFrom: Measurement.isHovered |
| isSelected | Method | inheritedFrom: Measurement.isSelected |
| preferReference | Method | Before the second object is picked: measure to the objects' references (a slot whose object has none stays on its surface) or to their surfaces |
| referenceToggleState | Method | One object's Centre line toggle (0 the first object, 1 the second): whether it is measured on its reference, and whether that can be switched: not for a leve… |
| remove | Method | inheritedFrom: Measurement.remove |
| setReferenceMode | Method | Measure one object (0 the first, 1 the second) on its reference or on its surface, the other staying as it is: a choice for the computation while picking, a … |
| undoPoint | Method | Remove the last placed point while this measurement is being taken, see Measuring.undoLastPoint inheritedFrom: Measurement.undoPoint |
constructor#
constructor()inheritedFrom: Measurement.constructor
distance#
public distance(): number | nullReturns#
The distance in millimetres, or null while there is no result
editable#
public editable(): booleanWhether the points of this measurement can be dragged to a new position after it has been finalized (default true). Supported for area, path and point measurements, and for the laser, which is dragged as a whole by its instrument (a click on it selects it instead); the other types have no draggable points. The points show a pointer cursor on hover; while dragging, vertex snapping applies as during measuring (Shift temporarily disables it) and the label (area/length/position) is updated in realtime. Dropping the point fires the committed listener event, Escape cancels the drag
inheritedFrom: Measurement.editable
editable#
public editable(editable: boolean): voidinheritedFrom: Measurement.editable
Parameters#
| Name | Type | Description |
|---|---|---|
editable |
boolean |
editState#
public editState(): { index: number | null; moved: boolean; originalText: string | null } | nullThe point being dragged (see editable): its index, whether it moved yet, and the measurement's value before the drag as its label shows it. Null when no point is dragged. A right-click during the drag puts the point back, like Escape. For a laser, index is the beam end dragged along its beam (0-2 the ends along the axes, 3-5 those opposite), null while it moves as a whole by its instrument; originalText is null
inheritedFrom: Measurement.editState
finished#
public finished(): booleaninheritedFrom: Measurement.finished
Returns#
Whether this measurement is finished
id#
public id(): numberGet the unique identifier of this measurement
inheritedFrom: Measurement.id
mode#
public mode(): ObjectDistanceModeReturns#
The distance definition of this measurement
pointCount#
public pointCount(): numberinheritedFrom: Measurement.pointCount
Returns#
The points placed so far while this measurement is being taken (objects picked, for an object distance)
qids#
public qids(): [string | null, string | null]Returns#
The qids of the two objects (null for a slot that has not been picked yet)
referenceModes#
public referenceModes(): (ReferenceMode)[]Returns#
Per object, whether it is measured on its surface or on its reference (centre line / axis plane)
referenceObjects#
public referenceObjects(): (ReferenceObject | null)[]Returns#
Per side, the level or grid line it holds instead of an object, or null
referenceOn#
public referenceOn(): booleanWhether the measurement goes to the references of its objects: while picking the choice made with preferReference, once finished whether a slot actually uses its reference
references#
public references(): (ObjectReference | null)[]Returns#
The references of the two objects once they have been fetched (the first O key press fetches them), null per object without one
result#
public result(): ObjectDistanceResult | nullReturns#
The result, or null while the objects are still being picked or the distance is being computed
snapsToVertices#
public snapsToVertices(): booleaninheritedFrom: Measurement.snapsToVertices
Returns#
Whether the points of this measurement snap to vertices and edges (point, length, area, angle)
canCycleReferenceMode#
public canCycleReferenceMode(): booleanWhether the O key can cycle this measurement's reference modes: it is finished and both objects are known
canFinish#
public canFinish(): booleaninheritedFrom: Measurement.canFinish
Returns#
Whether finish() would complete this measurement now (enough points for a length or an area)
cycleReferenceMode#
public cycleReferenceMode(): Promise<boolean>Move to the next reference-mode state and recompute (the O key): surface/surface, then B on its reference, both, A alone, skipping states an object without a reference cannot take. Fires committed again on the new result.
Returns#
true when the modes changed; false when neither object has a reference, or while a computation is still running
getViewFitPoints#
inheritedFrom: Measurement.getViewFitPoints
Returns#
The points (viewer measurement coordinates) a camera fit on this measurement encloses, or null when it has none yet
isHovered#
public isHovered(): booleaninheritedFrom: Measurement.isHovered
Returns#
Whether this measurement is hovered
isSelected#
public isSelected(): booleaninheritedFrom: Measurement.isSelected
Returns#
Whether this measurement is selected
preferReference#
public preferReference(on: boolean): booleanBefore the second object is picked: measure to the objects' references (a slot whose object has none stays on its surface) or to their surfaces
Parameters#
| Name | Type | Description |
|---|---|---|
on |
boolean |
Returns#
Whether the choice could be made (not once finished, use cycleReferenceMode then)
referenceToggleState#
public referenceToggleState(slot: 0 | 1): ReferenceToggleStateOne object's Centre line toggle (0 the first object, 1 the second): whether it is measured on its reference, and whether that can be switched: not for a level or grid line, nor, once the references are in, for an object without one. In vertical mode a vertical centre line (a window's, a column's axis) is measured from its middle, the object's centre height
Parameters#
| Name | Type | Description |
|---|---|---|
slot |
0 | 1 |
remove#
public remove(): voidinheritedFrom: Measurement.remove
Returns#
Remove this Measurement
setReferenceMode#
public setReferenceMode(slot: 0 | 1, on: boolean): Promise<boolean>Measure one object (0 the first, 1 the second) on its reference or on its surface, the other staying as it is: a choice for the computation while picking, a recomputation once finished (fires committed again, as cycleReferenceMode)
Parameters#
| Name | Type | Description |
|---|---|---|
slot |
0 | 1 |
|
on |
boolean |
Returns#
Whether the modes changed; false when the object has no reference (a message says so)
undoPoint#
public undoPoint(): booleanRemove the last placed point while this measurement is being taken, see Measuring.undoLastPoint
inheritedFrom: Measurement.undoPoint
Returns#
Whether a point was taken back