Create a new Viewer3d.
Every viewer loads its own copy of the models, also when its ObjectStateManager is on the same ModelManager as another viewer's (Viewer3D-Next shares them).
The ObjectStateManager manages all object related state such as visibility, color and selection
OptionalloadProgressHandler: LoadProgressHandlerAn object that get's specific methods called when there is progress to be reported
Optionalsettings: Viewer3dSettingsOptional settings
Optionalcanvas: HTMLCanvasElementA canvas to render on instead of one the viewer creates
Optionalcontainer: HTMLElementThe element the viewer's overlays go in, when a canvas is given
ReadonlycanvasThe canvas the viewer renders on
ReadonlyclientReadonlycontainerReadonlyfiguresFigure layers (docs/quantity-takeoff-design.md §8): many quantity figures at once - the parts of a sum - drawn as pickable overlays, one colour per entry state. Every resetResults clears them, like the overlays they are drawn with.
The font size of the plan labels in pixels, 15 by default (as Viewer2d.fontScaling)
ReadonlyframesConversions between the render frame and a loaded version's own frame, @bimworks/viewercommon!VersionFrames
ReadonlymodelReadonlyobjectReadonlyoverlaysCheck overlays (docs/check-overlays-design.md): semantic geometry a check sends with its
result, bound to one model version and drawn with that model's placement. An overlay whose
model is not loaded yet appears when it is. Arrow, area, label, path, mesh and glTF items;
other item types are skipped with a warning. Overlays are result geometry: resetResults
removes them, except those added with persistent: true.
ReadonlysettingsReadonlyviewpointsStored viewpoints: the view as a JSON value that outlives the session and loads in any order (@bimworks/viewercommon!Viewpoints.capture), and back (@bimworks/viewercommon!Viewpoints.restore) (BimRepository/docs/viewpoint-contents-design.md). captureViewState is the in-memory counterpart
Get a reference to the Measuring component which can be used for measurements related actions
Add a layer of template annotations to every viewer of this viewer's object state manager: a shortcut for getObjectStateManager().addAnnotationLayer(options) (Viewer3D/docs/rich-annotations-design.md §5.3)
listener(versionUuid, semantics) is called when a DWG model's (or geometry PDF's) layouts load, before its sheets are hidden
Objects whose oriented bounding box is drawn
OptionaloriginalQueryList: string[] | nullOptionaloptions: StateChangeOptionsObjects were added to the selection
The objects added
Objects were made visible
OptionaloriginalQueryList: string[] | nullOptionaloptions: StateChangeOptionsCalled once when the viewer gives up on the GPU. Viewer3D: the WebGL context was lost, as when the browser's GPU process is killed ({engine: "webgl", reason: "context-lost"}). Viewer3D-Next: the device kept getting lost, or no new one could be made. The viewer draws and picks nothing any more and is not restored; destroy it and build a new one on the same ObjectStateManager (a Viewer3D after Viewer3D-Next), or reload the page.
Adds a GIS layer definition to the viewer. It loads now only when visible is true; an invisible layer is only
registered (a terrain known before the imagery that drapes over it, a layer switched on later with toggleGisLayer)
handler(event, bindingType) runs on a key-up in the viewer before the viewer's own handling and returns true when it consumed the key (the takeoff editor's O and Delete); a consumed key-up does not propagate to the host. bindingType is the key binding's name, e.g. "toggleAreaHoles" for O; undefined for an unbound key.
listener.modelClustersChanged(clusters) whenever the clusters were computed again (after models were loaded or unloaded)
Models were loaded: their object data is in the ModelManager already
The versions that were added
Includes navigation exits initiated by Escape or loss of pointer lock.
Turn a quantity figure into committed measurements: an area (with holes) per polygon, a path per polyline, a distance per dimension; a box is not convertible. Their labels are recomputed by the viewer, so they can differ from the stored quantity on a curved or simplified figure.
Optionaloptions: QuantityFigureOptionsThe measurements added, at most 16
fn() when the viewer wants a frame (MapLibre mode: repaint the map); once per request, not once per internal change
listener() is called by every resetResults: whoever owns the shown result lets go of it
Called with the new state whenever the shadow settings change.
Called with the new state whenever the sun changes: settings, mode, or the reference model.
Apply an explicit, validated camera probe without animation. Position/direction are metres.
The pose (eye, pivot, target) of a camera has been updated (ObjectStateManager.setCameraPose)
The tag the pose was set with, to recognise one's own updates: "viewer3d" from the Viewer3d, null from the application; compare it, do not use it as an object
The new camera pose, in the 3D viewer's render frame
The view as it is now, as a value to give back to restoreViewState later: the object state (@bimworks/viewercommon!ObjectStateManager.captureObjectState: visibility, colours, on-top, sectionable, pickable, x-ray), the camera (Camera.getViewpoint) and how section planes cut the model (SectionPlanes.getState). A tool that takes the view over for a while (a check, the clash view) captures it when it starts and restores it when it ends, instead of undoing each of its own changes.
A new value, not live
Removes the annotations this viewer shows. Annotation layers stay; ObjectStateManager.clearAnnotations() removes those too, in every viewer
Removes all route polylines and stops any route playback.
Remove every quantity figure
The colour of the given objects has been reset to their own
The objects whose colour was reset
Destroys the viewer and any (heavy) resources associated with it. As long as there is a reference to the Viewer3d instance it won't be completely destroyed.
Disable any active sectionplanes
The tracker that knows which IfcSpace / IfcZone the camera is in (docs/current-space-design.md): loads the server-generated space index of the loaded models on first call, then locates the camera locally on every camera change and fires "current_space_changed" / "current_zone_changed". Resolves to null when no loaded model has a space index. With settings, a new tracker is created with them and an existing one is configured with them (CurrentSpaceTracker.configure).
Optionalsettings: Partial<CurrentSpaceTrackerSettings>Focus the viewer (keyboard focus on its canvas). Does not scroll the page.
Flies the camera along a route at constant walking speed (default 1.4 m/s), the look target running ahead - the interactive preview of the server-rendered flythrough video. Playback starts immediately unless options.autoplay === false.
Optionaloptions: FollowRouteOptionsView the set of loaded models from the front
The group names (Annotation.group, an AnnotationLayer's group) of the annotations shown in this viewer
The annotation layers of this viewer's object state manager
At most how many annotations are shown, 0 for no limit.
Whether annotations are drawn smaller further away, unless they say otherwise.
The background colour, components 0..1
The current Camera
The Canvas element used for rendering 3D content
The triangle budget culling keeps to while the camera moves: whether the running culler supports one, whether it is measured from the frame rate, the fixed number of triangles, and the budget in effect now
The current-space tracker if one exists and is not disposed; never creates one (use ensureCurrentSpaceTracker for that)
Detached applied-state, renderer-membership and annotation-DOM diagnostics; not a pixel certificate.
versionUuid → the layouts of every loaded DWG model (and geometry PDF) that has them; the viewer's own map, do not change it
The main bounds of the visible models where they render (render frame, mm), the box the toolbar's fit uses with Camera.viewFit: outlying parts left out, as getMainBounds. A new box on every call; empty (isEmpty()) while no model is visible
GEO mode: where the render frame sits on the globe. Its x/y origin is the reference model's georeference anchor, at the georeference's longitude/latitude (WGS84 degrees) and elevation (metres); anchorZ is the anchor's height in the render frame (mm). The frame's axes are east, north and up. Null while no georeferenced model is loaded
What the viewer knows about a GIS layer, a copy; null for an unknown id
Every GIS layer the viewer knows, as copies
The current reference grid configuration, with every property populated.
The grid line spacing that snapping is currently using, which follows the zoom level, so it can be shown in the UI as the active increment.
The spacing in meters, or null when the grid is hidden, grid snapping is off, or the grid plane is not in view.
Get the height of the viewer in pixels
Get the Axis Aligned Bounding Box (AABB) of the main content. For most models (or model sets) these are just the bounds of all 3D geometry. In certain cases the "Main" bounds are smaller than the real bounds, for example in models that have line geometry that extends beyond the 3D geometry, als certain IFC types are generally regarded as not being part of the main bounds.
An AxisAlignedBoundingBox3D object
The current viewer mode, either LOCAL (Using local coordinates) or GEO (Using geo coordinates)
The alignment in effect for a loaded model: a rigid transform of its model frame (mm, column-major), or null for none. A preview set with setModelAlignment wins over the version's stored alignment. A copy.
The bounds of the given models where they render, alignment and placement applied
The model clusters, as values: models more than ~10 km apart form separate clusters (setting clustering)
A loaded model's main bounds (outlying parts left out, as getModelBounds) in its own model frame (raw model mm, the frame modelToMeasurementCoordinates takes), before alignment and placement; null when it is not loaded. getModelBounds gives them where the model renders
Millimetres per length unit of a loaded model (1 for a model in mm, 1000 for metres); null when it is not loaded
Get a reference to the MovablePlanes component: planes with a drag icon that do not cut, in any number, with listeners
The current multiselection mode
The current predefined navigation mode or custom navigation mode name.
The configured near plane in meters, or "auto" when automatic near-plane calculation is enabled.
Information about all model versions currently available for offline use. Works both online and offline.
Get the stored Version objects for offline-prepared models. This is the offline replacement
for client.fs.getNodeVersion(): use the returned Version objects with
Viewer3d.addModels while in offline mode.
The version UUIDs
The bounding box of a quantity figure in render coordinates, null for an empty figure
Optionaloptions: QuantityFigureOptionsGet a reference to the SectionPlanes component which can be used for creating/modifying/removing section planes and boxes
The current selection mode
Returns the current viewer-wide selection style. Reapply with setSelectionVisualization after editing.
The shadow settings, whether shadows are drawn now, and the last shadow map's cost.
The sun's settings and where it stands.
Current text annotation display mode.
Get the width of the viewer in pixels
What mode of wireframe rendering is in
Returns the current x-ray set style. Reapply with setXRayVisualization after editing.
Shows a DWG model's model space again and hides its sheets: the way back from showDwgLayout with a sheet
Remove the quantity figure shown under the key, if any
Optionaltype: stringCalled when the given object is not being hovered on anymore
The Qid of the object that is not being hovered over anymore
Called when the given object is being hovered on
The Qid of the object being hovered over
The object hovered before, null or undefined for none
OptionalscreenspaceLocation: vec2The screenspace location of the hover event, when the caller gave one. This can be useful to for example place a popup/tooltip at that location. Screenspace location is x, y coordinate between 0, 0 and canvas width,height
Initializes the Viewer3d, it is important to wait for this async method to finish before calling any other methods on the viewer
Whether the viewer is in 2D mode, by set2dMode or because the scene is flat
Whether the default animation (the rotation along the Z-axis, toggleAnimationEnabled) runs
Whether the background is currently painted as the default gradient rather than as the flat colour from setBackgroundColor.
Whether this viewer culls while the camera moves. Fixed when the viewer is created (realtimeSettings.culling)
Whether rendering of generated door opening directions is currently enabled
Whether face rendering is currently enabled
Whether forced two-sided rendering is currently enabled
Whether the viewer is in full screen: the browser's, or the container's layout without the Fullscreen API
Whether the reference grid is currently shown.
Whether IFC line rendering is currently enabled
Whether the viewer is currently in offline mode
Whether a tool waits for an object click (selectObject, object distance, a click handler); the hovered object then gets the pick-target highlight.
Whether the plan labels are on
Whether the view has captured the mouse right now
Whether the edges of every triangle are drawn (setTriangleLineRendering)
Whether vertex rendering is currently enabled
Keeps this viewer's camera and other's together, in the measurement frame (so it works across different render frames): whichever camera the user moves or animates leads, and a press in the follower takes over at once. This viewer's camera is copied to other first. Works before either viewer is initialized.
A point in the measurement frame in the model frame of the given model, before its alignment (the inverse of modelToMeasurementCoordinates); null when the model is not loaded
@bimworks/viewercommon!ModelVisibilityListener: hides the models' geometry as a whole
@bimworks/viewercommon!ModelVisibilityListener: shows the models' geometry again
Whether the viewer wants another frame: data still to upload, an animation or a camera move under way
Find what is under a position on the canvas - the object, the point hit and the normal of the
face there - without changing the selection. The rightMouseClick setting already receives
this for the position of the right click; use this method when your UI picks at another moment,
for example a tool that waits for the next click on a face.
CSS pixels from the left edge of the canvas, e.g. MouseEvent.offsetX of an event on the canvas
CSS pixels from the top edge of the canvas, e.g. MouseEvent.offsetY
What is under the position, or null when the viewer could not pick (before its first frame, or the camera moved while picking)
Make a set of model versions available for offline use. While online, the viewer downloads everything needed to later load these models without a server connection and stores it in the browser (IndexedDB).
IFC/BIM and PDF models are supported; point cloud and GLB versions are reported as
skippedUnsupported in the result.
Preparing a vid that is already available offline refreshes it (re-downloads and replaces the stored data). Do this after the server has been updated/reindexed: reindexing on the server breaks offline-stored models (see the note at Viewer3d.setOfflineMode).
The version UUIDs to prepare
Optionaloptions: OfflinePrepareOptionsOptional progress callback
A per-vid result: prepared, failed (with reason) or skippedUnsupported
The primary selection has changed (only with settings.managePrimarySelection)
The newly selected primary object, null or undefined when the primary selection was cleared
A quantity figure as viewer geometry: the flat metre coordinates in model space become points in millimetres in the measurement frame of the model vid (its placement applied, see modelToMeasurementCoordinates). Primitives with too few points are dropped
The figure JSON, as for showQuantityFigure
The version uuid of the model the figure belongs to
The converted figure, or null when the figure has no usable primitive
Drops the tracker (after models were added or removed) and loads a fresh one.
Optionalsettings: Partial<CurrentSpaceTrackerSettings>{@inheritDoc @bimworks/viewercommon!ObjectStateListener.removedFromObbVisibleSet}
Objects were removed from the selection
The objects that are no longer selected
The origin of the change
Objects were hidden. Any of them that were selected have been deselected first
Forgets a GIS layer entirely, so that a layer whose definition changed is rebuilt on the next toggle
Models were unloaded
The versions that were removed
Remove model versions from the offline set and delete their stored data. Removing a vid that is not in the offline set is a no-op.
The version UUIDs to remove
Request the viewer to re-render the content
MapLibre mode: draws one frame with the custom layer's matrices; call it from the layer's render(gl, args). modelMatrix maps the render frame to the map's world space (transform.getMatrixForModel at getGeoFrameOrigin, mm to m, Z-up to Y-up); projectionMatrix is args.defaultProjectionData.mainMatrix. A null modelMatrix uploads pending data and draws nothing (before the frame origin is known). The matrices are copied. Picking is refreshed once the camera has settled
Takes away what the shown result drew - BVL and query shapes, routes, result overlays, figure layers, BVL annotation layers - and undoes the object states it switched on (the on-top set, pickability). Reset listeners are called: an owner of the shown result (the active check) lets go. Resolves once the states are undone. Persistent overlays, annotations, measurements and section planes stay (docs/ui-api-wp5/README.md §2.1)
Puts the camera back at the default view of the loaded models
Restore wireframe visibility and colour defaults for the supplied objects, or all objects when omitted.
Optionalqids: Iterable<Qid, any, any> | nullResize the viewer. This should only ever be called when autoresizing is off. It is higly recommended to let the Viewer3d manage it's own size based on it's position within the document
The drawing buffer width in pixels; in MapLibre mode both are ignored and the shared canvas's size is used
The drawing buffer height in pixels
Brings a captured view back: the object state (@bimworks/viewercommon!ObjectStateManager.restoreObjectState, models loaded since the capture keep their own state), the section planes (SectionPlanes.setState) and the camera (Camera.setViewpoint).
Optionaloptions: { animate?: boolean; keepCamera?: boolean }animate: fly the camera back (500 ms) instead of jumping, false by default; keepCamera: leave the camera where it is, as closing a check does
Resolves when the object state is applied (an animation may still run)
Save a PNG through Flutter's native save picker or a browser download. Embedded clients may supply their own handler; returning false means cancelled.
Optionaloptions: ScreenshotOptions & {Will take a screenshot of the contents of the Viewer3d.
Optionaloptions: ScreenshotOptionsOptional options object
A Blob
The returned Blob can for example be downloaded by the user, using the following example
import {Utils, EncodingUtils} from "@sascom/commonjs";
const blob = await viewer3d.screenshot();
const width = viewer3d.width;
const height = viewer3d.height;
const filename = `screencapture-${width}x${height}.png`;
Utils.downloadBlob(blob, filename);
OR (to base64)
const base64 = EncodingUtils.base64EncArr(blob);
Pick one object for a tool without changing the viewer's ordinary selection. An empty-space click supplies null; clients may retry or cancel the handle.
An opaque handle: it has no members of its own, it only identifies this request to cancelObjectSelection
Waits for one click on a model and calls back with the point clicked, snapped to a nearby vertex or edge. A click on nothing calls back with null and keeps waiting.
Optionaloptions: { snapping?: boolean }snapping false: the exact point clicked, and Shift does not turn snapping on (default true)
The selector: cancel() stops waiting
2D mode: the scene as a plan. A drag with the main mouse button (one finger) turns it about the vertical axis
through the point under the pointer, nothing tilts, and a pan moves the scene with the pointer, one to one. A
flat scene (a PDF or DWG drawing on its own) is in 2D
mode by itself; true puts a 3D model in it too (a storey plan), false keeps a flat scene in 3D, null lets
the scene decide again. The camera stays where it is: pair it with a view from the top.
Shows or hides one annotation group in this viewer; remembered for annotations added to it later
Show at most this many annotations, those nearest to the camera; 0 (the default) shows them all. Annotations hidden behind other geometry take no place, and hovering an object still shows its annotation. Applies immediately, on top of the limits of annotation groups (Annotation.groupLimit).
Draw annotations smaller the further they are from the camera (never larger than their normal size), except those whose Annotation.scaleByDistance is set. Applies immediately.
Shows or hides all annotations in this viewer (another viewer on the same ObjectStateManager keeps its own); remembered for annotations added later
Switch between the default vertical stage gradient and the flat colour set with setBackgroundColor. The flat colour is kept while the gradient is on, so a caller can toggle back and forth without having to set it again.
Show only the objects of one building storey (ObjectStateManager.setBuildingStoreyVisibleExclusive with one storey)
Sets the section cap style of objects: the pattern of their caps with SectionPlanes.capStyles (docs/section-cap-patterns.md). embedded: they are embedded elements (reinforcement, tendons, cast-in items), whose caps are found apart from those of the solids they lie in. Objects start "generic". Viewer3D draws only its uniform hatch and ignores the styles
While set, a click in the viewer goes to the handler instead of changing the selection; qid is null for a click on nothing. A tool's one-shot selectObject still takes precedence.
Sets the triangle budget: automatic (measured from the frame rate, the default) or a fixed number of triangles. Only the given properties change
Sets a GIS layer's opacity, 0 (invisible) .. 1 (opaque); kept, so a later (re)build of the layer has it. Imagery layers show it
Show or hide the infinite reference grid: a horizontal plane of metric grid lines that extends to the horizon, intended as a starting point when modelling from scratch. Line spacing follows the zoom level in decades (0.1 m, 1 m, 10 m, ...). The grid also acts as a surface for the orbit pivot and for double-click-to-fly-to, so orbiting and zooming over empty space behave the same as over a model.
Configure the reference grid. Only the given properties are changed, the rest keep their current value. Has no effect on whether the grid is shown, see setGridEnabled.
Set the face color for hovering. This color is mixed with the current color of the object (either original or overridden by user). Using a transparency component is currently not supported and results in undefined behaviour.
Set the wireframe color for hovering. This color is mixed with the default wireframe color. Using a transparency component is currently not supported and results in undefined behaviour.
Set the current viewer mode, either LOCAL (Using local coordinates) or GEO (Using geo coordinates)
A boolean indicating whether the mode was changed. Note that you can only switch to GEO mode if all loaded models are georeferenced. Also note than when nothing was changed as the result of calling this method, it also returns false
Shows a loaded model with this alignment without storing it (store it with the server's SetAlignment); null puts back the version's stored alignment. The scene bounds follow.
Shows or hides a whole loaded model without unloading it; the scene bounds and the view fit follow the visible models
Change the way multiselection is done (only applicable when ObjectStateManager's multiSelect is on). The default mode is SHIFT
The new multiselection mode; may be set before the viewer is initialized
Configure the perspective near plane in meters, or set it to "auto" to let the viewer calculate it from the current model and camera state.
Whether objects light up (and report hover) under the pointer; default true. A tool that waits for a precise click switches it off, as the measuring tools do by themselves while they are active. Switching it off drops the current hover; may be called before initialization
Enter or exit offline mode. In offline mode the viewer makes no server calls: only models prepared with Viewer3d.prepareOfflineModels can be loaded, and Viewer3d.addModels rejects with ModelNotAvailableOfflineError for any other model. GEO mode is unavailable while offline.
Note that models prepared for offline use are broken by a server reindex. This is usually fine: a reindex normally accompanies a new BIM.works version — and typically an updated Viewer3d — so re-prepare your offline set after updating.
true to enter offline mode, false to leave it
Text labels in plan views (2D mode, see Viewer3dSettings.planLabels): the labels of ObjectStateManager.setLabels and a default label on every space, inside their objects when they fit. On by default
Configure the camera-proximity fade that is applied to soft-occluder objects (see ObjectStateManager#setSoftOccluderSet). All distances are in model units (usually mm).
Partial configuration, unknown keys are ignored: fadeNear (fully faded distance, default "auto" = median soft-occluder height), fadeFar (fade start distance, default "auto" = 2.5x fadeNear), minRampRatio (default 2.0), smoothingTauMs (camera damping, default 100), nearPlaneMargin (extra clip-safety margin, default 100)
Set the selection mode. Currently there are 2 modes, the default mode is SELECTION_DIRECT_PICKING.
The new selection mode
Change how selection is visualized throughout this viewer, including already selected and subsequently loaded objects. Requests an immediate redraw. The default is orange wireframe. Choose WireframeSelectionVisualization, FatWireframeSelectionVisualization, FaceAndWireframeSelectionVisualization, XRaySelectionVisualization, or NoneSelectionVisualization for no face/edge highlight. Any style can independently enable extendedObbEnabled and set extendedObbColor.
For opaque face selection, color precedence is selection highlight > user color override > original object color. X-ray selection blends a translucent overlay over the scene, including hidden selected surfaces. Wireframe-only modes leave face colors unchanged. Removing selection (or disabling face highlighting) reveals the latest user color, or the original if the override was reset. Changing user colors while selected does not remove the selection highlight.
Face/edge style and color changes update shared uniforms, independent of the number of selected objects: no per-object color copies, geometry rebuilds, or color-buffer uploads. Selection uses cached selected-object batches for both batched and instanced geometry. Face highlighting adds one triangle pass over those batches; wireframe modes add no face pass. X-ray uses the same batches with blending and no depth testing/writing; dense overlapping selections cost more pixel work. Neither face style needs additional full-screen buffers. Extended OBB instances are built lazily and refreshed when selection, visibility or objects change. Subsequent OBB color and camera changes reuse those buffers. Set a new visualization (or reapply an edited one) to redraw after changing its colors.
Viewer-wide selection style and colors.
Shadows. "ground": a soft shadow straight below the models on an invisible ground plane, under any lighting. "sun": the sun's shadows on the models, terrain and imagery, drawn while the sun lights the scene (setSun). The shadow map does not depend on the camera: it is drawn again only when the sun, the visible objects, the section planes or the geometry change. Only the given options change.
Light the scene with the sun instead of the headlight, and set where it stands. Only the given options change; the others keep their values. The sun is computed for the reference (first) model's georeference, with true north corrected for the grid convergence of its projected CRS.
The resulting state, as getSun
Show text annotations as full labels (default), or dots that expand on dot/object hover. Applies immediately.
Draws the edges of every triangle, a diagnostic view
Override per-object wireframe colour with a CSS colour string, or null to restore the fixed default.
Sets when wireframes are drawn: always, only once the camera stands still, or never
Override wireframe visibility per object. true shows edges even with hidden faces, false hides edges, null restores following object visibility (the default). The global wireframe rendering mode still applies. Wireframe-only objects are not picked. Overrides survive face visibility changes and streaming; BVL results and resetAll reset them.
Change how the ObjectStateManager's x-ray set (addToXRaySet / setXRaySet) is drawn. The x-ray set is independent of selection: its objects are drawn with translucent faces and edges over the scene, without depth testing, so they show through whatever is in front of them. The objects keep their normal appearance underneath and stay pickable as before. Hidden objects are not drawn, and section planes clip the overlay. The x-ray pass runs before the selection pass, so a selected x-rayed object shows its selection on top. Colour changes update shared uniforms only. Set a new visualization (or reapply an edited one) to redraw after changing its fields. The default is blue faces at 15% opacity with pale blue edges.
Open the inspection panel (also Ctrl+Shift+F12 with the canvas focused).
Shows exactly one layout of a DWG model and fits the camera on it from the top
Shows only the cluster's models (the other clusters' are hidden), in LOCAL mode, and fits the view to them: what the viewer does with the biggest cluster after loading
Draw a quantity figure - the verification geometry a calculated quantity was measured on, as
GET calculated.quantity.<key>.figure returns it (metres, model coordinates) - as a transient
overlay in the measurement style, under a key; a figure shown under the same key replaces the
previous one. Not a measurement: no id, no handles, nothing in listMeasurements().
Any string, hideQuantityFigure(key) removes the figure again
The figure JSON: {kind, primitives: [{type: "polygon" | "polyline" | "dimension" | "box", ...}]}
Optionaloptions: QuantityFigureOptionsvid: the model the figure belongs to (its placement is applied), label: the text shown on the figure
Draws a walkable route (the polyline produced by the ComputeRoute API task) as a lifted polyline coloured by surface class, door crossings marked. Remove it with the returned object's destroy(), or clearPaths().
Optionaloptions: ShowRouteOptionsShows the box of the objects until hideTemporaryObb(key) is called with the same key and type
Optionaltype: stringView the set of loaded models from the side
Starts the viewer. The viewer will only redraw when needed.
Start default navigation mode. This controls mouse and keyboard camera interaction behavior.
Optionalsettings: NavigationModeSettingsStart drone navigation mode. If fullscreen is true, browser fullscreen is requested before navigation starts.
Optionalfullscreen: booleanOptionalsettings: NavigationModeSettingsDraws a footprint on a face and extrudes it into a solid, or edits an extrusion (options.edit). Enter or a
click places it (onCommit), Escape stops (onCancel). The drawn solid stays shown after the commit until
result.preview.remove(), so it can stand in for the object until the model has it
Start game navigation mode. If fullscreen is true, browser fullscreen is requested before navigation starts.
Optionalfullscreen: booleanOptionalsettings: NavigationModeSettingsStart a predefined navigation mode or a custom mode declared in settings.navigationModes.
Optionalsettings: NavigationModeSettingsOptionalfullscreen: booleanMove or rotate objects with an on-screen gizmo. A wireframe ghost of the objects' box follows the
gesture; the objects themselves do not change. Enter reports the accumulated transformation to
onCommit, Escape calls onCancel. Applying the result (a model transaction, an alignment) is up
to the caller.
The objects; their bounding box is what the gizmo shows
An opaque handle while the tool runs (it has no members of its own: only whether it is null means anything), null when the objects have no bounds (not loaded)
Start walk navigation mode. This controls mouse and keyboard camera interaction behavior.
Optionalsettings: NavigationModeSettingsStops the viewer. When the viewer is stopped, the view is not updated anymore. Any changes to the viewer will be accumulated and become visible as soon as the viewer is started again The main reason for stopping the viewer would be for performance, for example when the viewer is currently hidden
Toggles the default animation, which is an animation that continously rotates the building along the Z-Axis; returns whether it now runs
Toggle whether (generated) door openings are rendered. This only works for models that have been processed when the repository setting features.generate_door_openings had been enabled.
Some models contains door opening direction geometry as IFC lines, in those cases it's best to disabled rendering generated door openings.
True when enabled
Toggle whether faces are rendered.
True when enabled
Toggle whether to force always rendering faces two-sided (e.a. no back face culling). This overrules whatever BIM.works Repository has decided should happen.
True when enabled
Toggle whether the viewer is in fullscreen mode; the element that goes full screen is the setting browserFullscreenElement, else the container
Optionalenable: booleanWhether full screen was asked for (the browser may still refuse it; isFullScreen follows)
Toggle a specific GIS Layer on or off; resolves when it has loaded (or is hidden). Throws for an unknown id
Toggle whether ifc lines are rendered. IFC Lines are all lines that have been defined in the original IFC file, such as Axis and FootPrint representations.
True when enabled
Toggle whether vertices are rendered. Currently this does not have much use, in the future it will be used for snapping.
True when enabled
Toggle whether wireframes are rendered. Wireframes are usually drawn to emphesize the edges and generally make the model look better
True when enabled
View the set of loaded models from the top
Update the internal information for the given Version. If the given Version is not loaded currently, it is silently ignored. Call it after changing the georeference or the stored alignment (SetAlignment) of a loaded model; a preview from setModelAlignment stays in effect.
The Vid of the model that you want to update.
Whether the navigation mode looks around with the captured mouse (game, drone, or a custom mode with pointerLock). A right- or middle-click in the view leaves such a mode for the default one, as Escape does
Fit the given objects into view (ObjectStateManager.viewFit)
The objects to fit
Optionaloptions: ViewFitOptionsHow to fit, as the caller gave them
Fit the camera to a finished measurement (the "Zoom to" action of the measurement list). The box around the measurement's points is padded to at least minHalfMm in every direction so a small measurement stays readable
Optionaloptions: { animate?: boolean; minHalfMm?: number }false when the measurement has no points to fit yet
Fit the given models into view (ObjectStateManager.viewFitModels)
The models to fit
Optionaloptions: ViewFitOptionsHow to fit, as the caller gave them
Fit the camera to a quantity figure, animated
Optionaloptions: QuantityFigureOptionsWhether walk physics (collision, gravity, storey keys) can run for the loaded models: the server-generated walkable-surfaces artifact exists and could be loaded. Loads the artifact on first call.
Zooms the camera towards (negative value) or away from (positive) the scene at the canvas centre, animated. In perspective the eye moves |value| mm along the view ray; an orthographic camera scales its view window instead. zoomSteps zooms as the mouse wheel does
Zooms as steps mouse-wheel notches do (positive towards the scene; one notch covers half the
remaining distance), towards canvasPosition (CSS pixels) or the canvas centre, animated like the wheel
OptionalcanvasPosition: [number, number]
A 3D BIM viewer. Minimal example:
Example
The viewer registers itself with its ObjectStateManager and ModelManager and implements every method of @bimworks/viewercommon!ObjectStateListener except viewerRemoved (cameraPoseUpdated, primarySelectionChanged, setLabels and hoverOn do nothing), and those of @bimworks/viewercommon!ModelListener and @bimworks/viewercommon!ModelVisibilityListener; Viewer3D-Next implements the same. The managers call them, not the application: only those the application also calls directly are declared below.