BIM.works SDKs - v3.0.0-b.115
    Preparing search index...

    All measuring related methods are available on this class. Generally the Viewer3d has a reference to an instance of this class. There can only be one measurement "active" at a time. A measurement that is "active" is still being constructed by the user. When an active measurement is being "finished" it will stop being editable.

    Index

    Constructors

    • Should be considered private, only the Viewer3d will create an instance

      Returns Measuring

    Properties

    referenceObjectsVisible: boolean

    Whether the levels and grid lines are shown

    Accessors

    • get magnifier(): boolean

      Whether the magnifier is on: while a point tool aims with a mouse or pen, a round loupe beside the cursor shows the area under it enlarged, with the snap target. The session's choice, set with setMagnifier; on unless switched off

      Returns boolean

    • get vertexSnapping(): boolean

      Whether the point tools (point, length, area, angle) snap to vertices and edges, the session's choice set with setSnapping. Holding left Shift suspends it

      Returns boolean

    Methods

    • Add an angle measurement programmatically, for example a measurement that was stored in a database earlier

      Parameters

      • id: number

        A unique id that can be used to reference this measurement later. The user is responsible to make sure the id's of all active measurements are unique

      • coordinates: vec3[]

        Exactly 3 coordinates in 3D space: the end of the first arm, the vertex, the end of the second arm

      Returns AngleMeasurement

      The AngleMeasurement object

    • Add an area measurement programmatically, for example a measurement that was stored in a database earlier

      Parameters

      • id: number

        A unique id that can be used to reference this measurement later. The user is responsible to make sure the id's of all active measurements are unique

      • coordinates: vec3[]

        An array of coordinates in 3D space forming the polygon. The closing edge is implied, the first coordinate should not be repeated at the end

      • Optionalholes: vec3[][]

        Optional openings of the face this measurement was taken from, each a closed ring with the same convention as coordinates

      • Optionalmode: boolean | AreaMode

        Which figure the measurement reports, see AreaMeasurement.areaMode. Defaults to "net" when holes are given, "gross" otherwise; the boolean that predates the third mode is still accepted, true meaning "net". Both this and the holes are needed for a faithful round trip: the mode is a per-measurement choice, so the presence of openings does not by itself say which was in force

      Returns AreaMeasurement

      The AreaMeasurement object

    • Add a distance measurement programmatically, for example a measurement that was stored in a database earlier

      Parameters

      • id: number

        A unique id that can be used to reference this measurement later. The user is responsible to make sure the id's of all active measurements are unique

      • coordinate1: vec3

        The first coordinate in 3D space

      • coordinate2: vec3

        The second coordinate in 3D space

      • Optionalnormal: vec3

        The normal that was used on the first coordinate, this is not really used anywhere and can be left empty

      • Optionalconstrain: false

        Whether the original measurement was constrained, also not used anywhere to optional

      Returns DistanceMeasurement

      The DistanceMeasurement object

    • Place a laser again where one stood (LaserMeasurement.placement): its beams are cast again against the geometry loaded now, so they end where the objects are now

      Parameters

      • id: number

        A unique id, see addDistanceMeasurement

      • coordinate: vec3

        Where it stands, viewer measurement coordinates

      • normal: vec3

        The normal of the face it stands on

      • Optionaloptions: { onlyZ?: boolean; qid?: string | null; toReference?: boolean }

        qid: the object of that face; onlyZ: a vertical laser; toReference: the beams end on references (see LaserMeasurement.toReference)

      Returns Promise<LaserMeasurement | null>

      The finished LaserMeasurement, or null when its beams could not be cast (nothing is left behind then)

    • Add a new listener, a listener can have many methods implemented, but none of them are required

      Parameters

      Returns void

    • Add a finished object distance measurement programmatically (e.g. restored from a database), without recomputing it

      Parameters

      • id: number

        A unique id that can be used to reference this measurement later. The user is responsible to make sure the id's of all active measurements are unique

      • result: ObjectDistanceResult

        The result as measureObjectDistance returned it: the distance in mm, the two closest points and the qids

      Returns ObjectDistanceMeasurement

      The ObjectDistanceMeasurement object

    • Add a path measurement programmatically, for example a measurement that was stored in a database earlier

      Parameters

      • id: number

        A unique id that can be used to reference this measurement later. The user is responsible to make sure the id's of all active measurements are unique

      • coordinates: vec3[]

        An array of coordinates in 3D space

      • Optionalnormal: vec3

        The normal that was used on the first coordinate, this is not really used anywhere and can be left empty

      • Optionalconstrain: boolean

        Whether the original measurement was constrained, also not used anywhere to optional

      Returns PathMeasurement

      The PathMeasurement object

    • Add a point measurement programmatically, for example a measurement that was stored in a database earlier

      Parameters

      • id: number

        A unique id, see addDistanceMeasurement

      • coordinate: vec3

        The point, viewer measurement coordinates

      Returns PointMeasurement

      The PointMeasurement object

    • Ends a point drag and puts the point back, as Escape does; false when no drag was active

      Returns boolean

    • Whether the active touch measurement has enough points to finish (a path two, an area three)

      Returns boolean

    • Returns boolean

      Whether the running tool can use the magnifier: a point tool (point, length, area, angle) on a device with a mouse or pen. The Magnifier toggle is offered only then

    • Returns boolean

      Whether the running tool can snap: to vertices and edges for the point tools, to 100 mm and 15° steps for move/rotate

    • Remove all existing measurement listeners

      Returns void

    • Finish the active measurement the way Enter or a double-click does: a length needs two points, an area three corners and an angle its three points; with fewer the measurement stays active. For the move/rotate tool this applies the change

      Returns void

    • Returns number

      A fresh id for the add…Measurement methods, unique among the measurements of every viewer

    • What the active measurement measures (see kindOf), null when none runs or the move/rotate tool runs

      Returns string | null

    • The running tool, for a user interface that names it and offers its controls (the BIM.works mode bar), or null when nothing runs. Changes are announced with MeasuringListener.toolChanged

      Returns ActiveTool | null

    • Get the active measurement

      Returns Measurement

      The currently active measurement (being constructed), or null when no measurement is active

    • The measurement whose point is being dragged, or the laser being moved; null when none

      Returns Measurement | null

    • Returns Measurement

      The currently hovered Measurement, null if no measurement is being hovered over

    • Get the Measurement object for the given id

      Parameters

      • id: number

        the Id of the measurement, must be a number (int)

      Returns Measurement

    • The reference geometry of an object from the reference figures the server wrote at check-in, cached; null when the object has none

      Parameters

      • qid: string

      Returns Promise<ObjectReference | null>

    • The storey levels and grid lines setReferenceObjectsVisible loaded (measurement frame, mm), a copy; null before they are loaded

      Returns
          | {
              grids: { name: string; points: vec3[] }[];
              levels: { name: string; z: number }[];
          }
          | null

    • Returns Measurement

      The currently selected Measurement, null if no measurement is selected

    • Where a touch measurement stands: "aiming" (a finger is down under the loupe), "pending" (a point is previewed and waits for its checkmark) or "idle"

      Returns "idle" | "pending" | "aiming"

    • Returns boolean

      Whether a measurement is currently active (being constructed)

    • Returns boolean

      Whether the running tool snaps right now, with Shift taken into account

    • Parameters

      Returns
          | "length"
          | "angle"
          | "area"
          | "distance"
          | "point"
          | "laser"
          | "objectDistance"
          | null

      What the measurement measures: "distance", "length", "point", "area", "angle", "objectDistance" or "laser"; null for anything else

    • List the measurements currently finished

      Returns Measurement[]

      An array of Measurement

    • Load the levels (building storeys with an elevation) and grid lines of the loaded models, once per model set

      Returns Promise<{ grids: ReferenceObject[]; levels: ReferenceObject[] }>

    • Compute the shortest distance between the surfaces of two objects, without any interaction. The triangles of both objects are read back from the GPU and the closest pair is found in the browser; the result carries the two closest points

      Parameters

      • qidA: string

        The first object

      • qidB: string

        The second object

      • Optionaloptions: { add?: boolean; mode?: ObjectDistanceMode; references?: ReferenceMode[] }

        add: also add (and draw) the finished measurement, available as the result's measurement property

      Returns Promise<
          | ObjectDistanceResult & { measurement?: ObjectDistanceMeasurement }
          | null,
      >

      The result, or null when either object has no surface geometry (or is the same object)

    • fn(active) is called whenever a measurement tool becomes active or stops

      Parameters

      • fn: (active: boolean) => void

      Returns () => void

      A function that unsubscribes

    • Remove all the measurements

      Returns void

    • Remove an existing measurements listener

      Parameters

      Returns void

    • Remove a measurement by its id

      Parameters

      • id: number

        The unique if of the measurement

      Returns void

    • Gross, net or hull for the area measurement being taken (kept also where it does not apply yet, it takes effect on the face that is clicked), else for the selected finished one (only when it applies)

      Parameters

      Returns boolean

      Whether the mode was taken

    • Programmatically set the given measurement to be blurred. This will be reflected in 3D View. Keep in mind that this will trigger any listeners (for blurring measurements)

      Parameters

      Returns void

    • Programmatically set the given measurement to be the "hovered" measurement. This will be reflected in 3D View and any currently "hovered" measurement will be automatically blurred. Keep in mind that this will trigger any listeners (both for blurring any current measurement and for hovering the new measurement)

      Parameters

      Returns void

    • Switch the magnifier on or off: the session's choice, for the running measurement and the ones that follow

      Parameters

      • on: boolean

      Returns void

    • Show or hide the levels and grid lines on the overlay (loading them first). While shown, the vertical laser stops at the levels and an object distance that is picking takes a clicked level or grid line as one of its sides

      Parameters

      • visible: boolean

      Returns Promise<boolean>

    • Programmatically set the given measurement to be the selected measurement. This will be reflected in 3D View and any currently selected measurement will be automatically unselected. Keep in mind that this will trigger any listeners (both for unselecting any current measurement and for selecting the new measurement), depending on the triggerListeners parameter.

      Parameters

      • Optionalmeasurement: Measurement

        The measurement that you want to select. You can also pass null to unselect the currently selected measurement

      • OptionaltriggerListeners: boolean

        Indicate whether listeners should be called, the default value for this optional parameter = true. Regardless of the setting, listeners are only ever called when there is an actual change in selection

      Returns void

    • Switch snapping on or off. For the point tools this is the session's choice: it also holds for the measurements that follow, and left Shift keeps suspending it while held. For move/rotate it is the tool's step snapping, which Shift inverts

      Parameters

      • on: boolean

      Returns void

    • Start a new angle measurement. The user clicks exactly 3 points: the end of the first arm, the vertex (from where the angle bow is shown), and the end of the second arm. The measurement finishes immediately when the third point is committed, Escape cancels it

      Returns AngleMeasurement

      A reference to the started AngleMeasurement

    • Start a new area measurement. The user clicks a sequence of points forming a closed polygon, the enclosed area is shown at the centroid. Clicking the first point again (or pressing Enter, with at least 3 points) closes the polygon and finishes the measurement, Escape cancels it. In 3D the first 3 (non-collinear) points define a plane, any further points are constrained to that plane

      Returns AreaMeasurement

      A reference to the started AreaMeasurement

    • Start a new distance measurement

      Parameters

      • Optionalconstrain: boolean

        Whether this measurement should be constrained (perpendiculair to the starting face)

      Returns DistanceMeasurement

      A reference to the started DistanceMeasurement

    • Start a new 3-axis laser measurement. Keep in mind that this method is async, when first using the LaserMeasurement, the initial setup time can be longer

      Returns Promise<LaserMeasurement>

      A reference to the started LaserMeasurement

    • Start a new object distance measurement: the user clicks two objects and the shortest distance between their surfaces is drawn as a dimension between the two closest points. When exactly two objects are selected the measurement is computed at once, without further clicks. It finishes by itself once the distance is known, Escape cancels it. Not editable, static afterwards. Objects that touch or intersect report 0

      Parameters

      • Optionaloptions: {
            mode?: ObjectDistanceMode;
            qids?: string[];
            references?: ReferenceMode[];
            useSelection?: boolean;
        }

        sids or qids: measure these two objects instead of picking; useSelection: false ignores the current selection

      Returns ObjectDistanceMeasurement

      A reference to the started ObjectDistanceMeasurement

    • Start a new path measurement

      Returns PathMeasurement

      A reference to the started PathMeasurement

    • Start a new point measurement. A point measurement add's a label to a vertex

      Returns PointMeasurement

      A reference to the started PointMeasurement

    • Start a new 1-axis (vertical) laser measurement. Keep in mind that this method is async, when first using the LaserMeasurement, the initial setup time can be longer

      Returns Promise<LaserMeasurement>

      A reference to the started LaserMeasurement

    • Stops the currently active measurement and removes it. Clicks go back to the viewer's selection mode (rectangle selection included), also when no measurement was active

      Returns void

    • The O key ("toggleAreaHoles" key binding): cycle an area measurement through its modes gross, net and hull (see AreaMeasurement.cycleAreaMode), skipping the modes that would not change anything. The target is the measurement being created, else the selected one; a target that is not an area measurement, or has neither openings nor a concave ring, is passed over

      Returns AreaMeasurement | null

      The measurement whose mode changed, or null when there was nothing to cycle

    • Measure to the references (centre lines, axis planes) of the objects instead of their surfaces, or back: a choice for an object distance before its second object is picked, a switch for a finished one or a laser (the O key). With a slot (0 the first object, 1 the second) an object distance's Centre line toggle of that one object (setReferenceMode)

      Parameters

      • Optionalslot: 0 | 1

      Returns Promise<void>

    • The O key: cycle the reference modes of the active or selected object distance measurement (surface / centre line per object). The area measurement's own O behaviour (toggleAreaHoles) takes precedence when it applies

      Returns ObjectDistanceMeasurement | null

      The measurement being cycled (its recomputation is asynchronous), or null when there was none

    • Take back the last point of the running length, area, distance, angle or object distance measurement. Taking back the first point returns the tool to where it started

      Returns boolean

      Whether a point was taken back