---
title: Annotations to mobile
summary: A planner pins notes in 3D; a phone shows them live on a storey plan and reports back.
order: 10
layout: wide
languages: [javascript]
terms: [viewer, viewpoint, object-state-manager, model-manager, qid, building-storey]
see-also: [how-to/viewer3d/embed-the-viewer, how-to/viewer3d/annotations, how-to/viewer3d/measure, how-to/viewer3d/hide-and-isolate, how-to/viewer3d/dwg-drawings, how-to/geo/set-the-alignment]
---

# Annotations to mobile

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.

```demo
name: repair-annotations
title: Annotations to mobile
models: s1, s1-electrical, s1-pdf-0, dwg-plan
height: 780
needs: Uses the demo [[term:api-token|API token]] of your [[term:account|account]]: sign in to BIM.works once in this browser.
```

## Try it

1. **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.
2. **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.
3. **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.
4. **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.
5. **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 [[term:model|model]] [[term:version|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 [[term: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`. | [[page:how-to/auth/log-in-with-an-api-token]] |
| 3D view and plan | Two `Viewer3d`s on one [[term:model-manager|ModelManager]], each with its own [[term:object-state-manager|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. | [[page:how-to/viewer3d/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. | [[page:how-to/viewer3d/measure#own-click-tool|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. | [[page:how-to/geo/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. | [[page:how-to/viewer3d/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). | [[page:how-to/viewer3d/measure]] |
| Pins and cards | An annotation layer with the demo's template `repair.note`, styled with `AnnotationTemplateKit`. | [[page:how-to/viewer3d/annotations#own-template|Annotate a model]] |
| A note's view | `getCamera().getViewpoint()` when the pin is placed, `setViewpoint(vp, ms)` when the note is opened. | [[page:how-to/viewer3d/set-the-camera]] |
| Storeys | `client.bim.listBuildingStoreys`, `getObjectQidsForBuildingStoreyQids` and `setVisibleSet`. | [[page:how-to/viewer3d/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]})`. | [[page:how-to/viewer3d/show-a-floor-plan]] |
