Annotations to mobile
A planner pins notes in 3D; a phone shows them live on a storey plan and reports back.
Left: the planner's 3D view. Right: the electrician's phone. The ground floor's PDF plan and DWG drawing lie under the building, aligned with it.
Try it#
- Place a note. Pick a storey under Show, press Add note and click in the model. The arrow beside it sets the placement: Object (default) puts the pin where you click on an object, Snap snaps it to the nearest corner or edge, Free puts it exactly under the pointer. Every note is linked to the object its pin is on, or to the drawing when you click on the PDF or the DWG.
- Pick the models. Models turns the IFC models, the PDF plan and the DWG drawing on and off; IFC and PDF are on at first. The drawings show with the whole building and with the ground floor. Turn IFC off to place notes on a drawing alone. The phone follows.
- Watch the phone. The pin appears at once. Pick a storey from the phone's list; press a point and circle it to turn the plan (it snaps square), right-drag or two fingers to pan, scroll or pinch to zoom.
- Report back. On the phone, tap a pin, then Start or Done. The colour is the priority: grey low, blue normal, yellow high, red urgent. Start adds a deep-blue ring, Done turns the pin green.
- Edit or remove. On the planner's side, click a pin or a row of the list: the view returns to where it was when the note was placed. Back or Escape returns to the list.
Open on its own opens the phone in another tab; it stays in sync, with the models too. On your phone gives the app to a real phone: scan the QR code or copy the link, which signs the phone in to your Demo folder for 12 hours. The notes follow live; the models are those chosen when you opened the link.
Where the notes are kept#
With the Commenting feature, a note is a BIM.works conversation on the model version: the version of the object, or of the drawing for a note placed on the PDF or the DWG. StartConversation stores the point and the object, AddComment the text plus a tag line (#repair type=socket priority=high … by=planner), which also carries the Viewpoint (vp=, in metres) and the storey shown. The phone's reports are more comments; Done calls CloseConversation. Each screen keeps one ListConversations open with interactive: true, so the server pushes every change and nothing polls. Both screens use the same token; the by field tells them apart. A screen shows its own change at once, from the comment AddComment answers with; the push of it then finds the note already there. ListConversations is exclusive per session (a second listing ends the first), so each screen needs a session of its own: screens that share one, signed in with a remembered session instead of the demo token, pass their changes to each other over a BroadcastChannel.
Without Commenting, the notes stay in this browser and the card says so.
How it is built#
The modules are in BimRepository/www/docs-runtime/demos/repair/.
| What | How | Where it is explained |
|---|---|---|
| Two clients | The planner's client, and one of the phone's own: in the drawn phone a second createClientWithApiToken beside the planner's, so the phone has a session of its own, as a real phone would. A real phone gets a 12-hour login of the same token (LoginWithApiToken with expires_seconds) in the link's # fragment and signs in with createClientWithAuth. |
Log in with an API token |
| 3D view and plan | Two Viewer3ds on one ModelManager, each with its own ObjectStateManager: the planner's 3D view and the phone's plan show the same models, loaded once for both by the WebGPU viewer, with their own visibility, pins and camera. The phone in a tab or on a real phone loads them itself. |
Show models in several viewports |
| Clicking a point | viewer.setClickHandler and viewer.pick(x, y); Snap and Free use viewer.selectVertex, then viewer.pick round the point for the object it is on. |
A click tool of your own |
| The drawings | Before loading, CalculateAlignment from two corners of the building (the PDF, 1:100 and turned a quarter) or a lift alone (the DWG, drawn in the IFC's millimetres), then SetAlignment when the stored matrix differs. |
Set the alignment |
| Models menu | viewer.setModelVisible for a drawing; IFC through the visible set (hiding its layers leaves a flat scene, which the viewer turns to a top view). A BroadcastChannel carries the choice to the phone. |
Show DWG drawings |
| A note on a drawing | Where viewer.pick finds no IFC object: the picked point on the drawing (a PDF fills the pick buffer), else the pointer's ray meeting the drawing's plane (between a DWG's lines). |
Measure areas, angles and with the laser |
| Pins and cards | An annotation layer with the demo's template repair.note, styled with AnnotationTemplateKit. |
Annotate a model |
| A note's view | getCamera().getViewpoint() when the pin is placed, setViewpoint(vp, ms) when the note is opened. |
Set the camera from code |
| Storeys | client.bim.listBuildingStoreys, getObjectQidsForBuildingStoreyQids and setVisibleSet. |
Hide and isolate |
| Phone plan | An orthographic camera (camera.fov = 0) in 2D mode (viewer.set2dMode(true): going around the press point turns the plan, snapping square), fitted with viewer.viewFit(qids, {viewDirection: [0, 0, 1]}). |
Show a floor plan |