> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ploterr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dimensions on a storey

> Save dimensions, text notes and leaders on a storey, and show them on every plan of it.

A storey can hold plan notes: dimensions, text notes and leaders. They are saved in the building model, in metres, in the `annotations` list of the storey. Every plan view of the storey draws them, and so does every sheet that shows such a view. You change them with the same commands as a slab, so one undo step can hold a wall move and a dimension edit.

## Before you start

You have a project with the storey `ground` and the plan view `ground-plan`, from [Create a plan view](https://docs.ploterr.com/floorkit/guides/create-a-plan-view.md).

## Add a dimension

A dimension measures between two points of the plan, `[x, z]` in metres. `offset` moves the dimension line away from the points; its sign picks the side. The text is the measured length in millimetres, unless you give a `label`.

```typescript theme={null}
import { ProjectManager } from '@opengeometry/floorkit';

export function addDimension(manager: ProjectManager): void {
  manager.apply({
    kind: 'add-element',
    buildingId: 'building',
    storeyId: 'ground',
    list: 'annotations',
    element: { id: 'front-length', kind: 'dimension', start: [0, 0], end: [8.5, 0], offset: -0.8 },
  });
}
```

The plan prints `8500` above the dimension line.

## Make a dimension follow a wall

An end can name a point of a wall instead of a fixed point: `startRef` for `start`, `endRef` for `end`. `anchor` is the wall's `start` or `end` point, or its `left-face` or `right-face`. The left face is on the left when you walk the wall from its first point to its last. A face end goes to the point of the face nearest the saved point.

```typescript theme={null}
export function addFollowingDimension(manager: ProjectManager): void {
  manager.apply({
    kind: 'add-element',
    buildingId: 'building',
    storeyId: 'ground',
    list: 'annotations',
    element: {
      id: 'service-gap',
      kind: 'dimension',
      start: [0, 0],
      end: [8.5, 0],
      offset: -0.8,
      startRef: { elementId: 'w1', anchor: 'end' },
      endRef: { elementId: 'w2', anchor: 'right-face' },
    },
  });
}
```

Each edit writes the referenced ends again from their walls, in the same step. Move `w2` by 1 m and the dimension reads `9500`; one undo gives back the wall and `8500`. The saved `start` and `end` always hold the last points. Only a committed step of the project or session does this: the exported `applyBuildingEdit` and a live drag preview leave the saved ends as they are.

When you split a wall, a reference to its `end` goes to the new second wall. When you merge two walls, a reference to the removed wall goes to the kept wall. A reference to an end that becomes the joint is removed and sets `orphan: true`.

When you delete a wall that a dimension follows, the dimension keeps its last points, the reference to that wall is removed and the dimension gets `orphan: true`. It then prints dashed, with the same value. An end that still names a wall keeps following it.

An edit that gives a reference to an id that is not a wall of the storey is refused with `invalid-target`. An edit whose walls bring the two ends of a dimension together is refused with `invalid-geometry`.

## Add a text note and a leader

```typescript theme={null}
export function addNotes(manager: ProjectManager): void {
  manager.apply({
    kind: 'batch',
    commands: [
      {
        kind: 'add-element',
        buildingId: 'building',
        storeyId: 'ground',
        list: 'annotations',
        element: { id: 'note', kind: 'text', position: [2, 3], text: 'Check on site' },
      },
      {
        kind: 'add-element',
        buildingId: 'building',
        storeyId: 'ground',
        list: 'annotations',
        element: {
          id: 'post',
          kind: 'leader',
          target: [4, 0],
          points: [[5, 1]],
          text: 'Steel post',
        },
      },
    ],
  });
}
```

## Change and remove

Use `replace-element` with the whole new note, and `remove-element` with its id. Put them in a `batch` with a wall edit to make one undo step.

## Rules

* Points are in metres in the plan of the storey. The text is the `labelMm` of the view high on the paper, or 2.5 mm.
* A text reads from the bottom or from the right. A vertical dimension reads from the right.
* In a viewport turned 90° or 180°, each text turns in place so that it still reads from the bottom or the right. A label of two lines, such as a room name over its area, then shows its lines in the other order.
* A dimension end without `startRef` or `endRef` is a fixed point: it does not follow a wall that moves.
* A reference names a wall of the same storey. Openings, columns and grids cannot be referenced. A sheet `measure` keeps fixed ends.
* On a sheet, use a sheet `measure` for a dimension that belongs to one sheet only. See [Compose a sheet](https://docs.ploterr.com/floorkit/guides/compose-a-sheet.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.