Reference·JavaScript · @bimworks/viewer3dJavaScript

LaserMeasurement

Class in @bimworks/viewer3d.

API catalogue · @bimworks/viewer3d · Class

TypeScript#
class LaserMeasurement

Represents one LaserMeasurement. There can be multiple LaserMeasurements in one viewer, but only one can be active (moving around) at a time.

Inheritance and interfaces#

Members#

Member Kind Description
constructor Method inheritedFrom: Measurement.constructor
toReference Property Whether the beams end on the reference (centre line, axis plane) of the object they hit instead of its surface (docs/reference-geometry-measurement-design.md…
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
lengths Method
placement Method
pointCount Method inheritedFrom: Measurement.pointCount
snapsToVertices Method inheritedFrom: Measurement.snapsToVertices
canCycleReferenceMode Method
canFinish Method inheritedFrom: Measurement.canFinish
cycleReferenceMode Method The O key: toggle toReference and re-target every beam
getViewFitPoints Method inheritedFrom: Measurement.getViewFitPoints
isHovered Method inheritedFrom: Measurement.isHovered
isOnlyZ Method
isSelected Method inheritedFrom: Measurement.isSelected
remove Method inheritedFrom: Measurement.remove
undoPoint Method Remove the last placed point while this measurement is being taken, see Measuring.undoLastPoint inheritedFrom: Measurement.undoPoint

constructor#

TypeScript#
constructor()

inheritedFrom: Measurement.constructor

toReference#

TypeScript#
public toReference: boolean

Whether the beams end on the reference (centre line, axis plane) of the object they hit instead of its surface (docs/reference-geometry-measurement-design.md §4.2). Toggled by the O key while the laser follows the cursor or is selected (a click on its instrument), and by Measuring.toggleReference

editable#

TypeScript#
public editable(): boolean

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 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#

TypeScript#
public editable(editable: boolean): void

inheritedFrom: Measurement.editable

Parameters#

Name Type Description
editable boolean

editState#

TypeScript#
public editState(): { index: number | null; moved: boolean; originalText: string | null } | null

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 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#

TypeScript#
public finished(): boolean

inheritedFrom: Measurement.finished

Returns#

Whether this measurement is finished

id#

TypeScript#
public id(): number

Get the unique identifier of this measurement

inheritedFrom: Measurement.id

lengths#

TypeScript#
public lengths(): (number)[]

Returns#

The lengths its beams are labelled with (mm), axis by axis: the two beams along an axis read as one length, end to end, and the beam along the face normal stands alone. Empty before anything is hit

placement#

TypeScript#
public placement(): { coordinate: vec3; normal: vec3; qid: string | null } | null

Returns#

Where the laser stands, to place it again with Measuring.addLaserMeasurement: the point (viewer measurement coordinates), the normal of the face it stands on and the qid of that face's object; null until it is placed

pointCount#

TypeScript#
public pointCount(): number

inheritedFrom: Measurement.pointCount

Returns#

The points placed so far while this measurement is being taken (objects picked, for an object distance)

snapsToVertices#

TypeScript#
public snapsToVertices(): boolean

inheritedFrom: Measurement.snapsToVertices

Returns#

Whether the points of this measurement snap to vertices and edges (point, length, area, angle)

canCycleReferenceMode#

TypeScript#
public canCycleReferenceMode(): boolean

Returns#

Whether cycleReferenceMode applies: the laser has hits to re-target

canFinish#

TypeScript#
public canFinish(): boolean

inheritedFrom: Measurement.canFinish

Returns#

Whether finish() would complete this measurement now (enough points for a length or an area)

cycleReferenceMode#

TypeScript#
public cycleReferenceMode(): Promise<boolean>

The O key: toggle toReference and re-target every beam

Returns#

true when toggled; false when the laser has no hits yet

getViewFitPoints#

TypeScript#
public getViewFitPoints(): (vec3)[] | null

inheritedFrom: Measurement.getViewFitPoints

Returns#

The points (viewer measurement coordinates) a camera fit on this measurement encloses, or null when it has none yet

isHovered#

TypeScript#
public isHovered(): boolean

inheritedFrom: Measurement.isHovered

Returns#

Whether this measurement is hovered

isOnlyZ#

TypeScript#
public isOnlyZ(): boolean

Returns#

Whther this measurement is only measuring in the z-direction (vertically). When this returns false it is always a 3-axis laser measurement

isSelected#

TypeScript#
public isSelected(): boolean

inheritedFrom: Measurement.isSelected

Returns#

Whether this measurement is selected

remove#

TypeScript#
public remove(): void

inheritedFrom: Measurement.remove

Returns#

Remove this Measurement

undoPoint#

TypeScript#
public undoPoint(): boolean

Remove the last placed point while this measurement is being taken, see Measuring.undoLastPoint

inheritedFrom: Measurement.undoPoint

Returns#

Whether a point was taken back