# building

Optional building: rooms, walls, wall openings, floor markings, labels and plan fixtures in metres; the walls are the walled rooms' outlines and the free-standing wall lines, each with a height, thickness and finish. Drawn by the editor and written as the floor plan, 3D walls and floor texture; ignored by the engine.

In the model file this key holds `null`, or an object.

## Typical uses

These sections organise a model and leave notes for people. `submodels` are reusable definitions that SUBMODEL blocks instantiate. `info` holds the description and author. `annotations` and `background` draw notes, frames and a floor plan on the canvas, and `building` declares the floor plan itself: rooms, wall openings and labels in metres. `cranes` and `stockpiles` say how playback draws lifts and stores on that plan. `view` remembers where the editor was. Only `submodels` changes what a run does.

## Behaviour and rules

A submodel definition holds parameters, inner blocks, links and named ports. Before a run, every instance is replaced by a copy of the definition's blocks, named `<instance>/<inner>`, and the links are rewired through the ports. A definition may be reused with different arguments, and a definition that contains itself is an error.

The engine ignores `annotations`, `background`, `building`, `cranes`, `stockpiles`, `view` and `info`, apart from showing `info` in the report header. They never change a result. A background image has a position, a scale, an opacity, a lock and a real-world scale. A building's walls are not stored: they are the outlines of its rooms with `walls` true, merged per wall line and cut by its openings. The editor writes `view` on every save.

A crane's lift is any traced move with a duration between two blocks it serves. Playback splits that move into phases (the hook travels empty, lowers, carries the load, sets it down) without changing its start or its length. A `stockpiles` area draws its block's entities as slabs on a few piles instead of a queue row. Each entity's pile comes from `keys`, one per entity created at `source`, in creation order. Past `max_layers` a pile stops growing and its label counts.

## Fields

| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
| `extent` | list of number | yes |  |  | The plan's canvas [x0, y0, x1, y1], metres. |
| `ground` | string |  | `"#DCDCD6"` |  | The plan outside the rooms: a colour or palette name. |
| `palette` | object |  |  |  | Fill names -&gt; "#RRGGBB", used by rooms' fill. |
| `walls` | object |  |  |  | -- |
| `floor_tile` | number or null |  | `0.6` |  | Tile joints on the floor texture, metres; null for none. |
| `rooms` | list of object |  |  |  | -- |
| `wall_lines` | list of object |  |  |  | -- |
| `openings` | list of any |  |  |  | -- |
| `markings` | list of object |  |  |  | -- |
| `labels` | list of building label |  |  |  | -- |
| `fixtures` | list of object |  |  |  | -- |

A field of a nested object is described in the JSON Schema (`naga schema`).

## Example

```json
{"building": {"extent": [0, 0, 12, 8], "palette": {"office": "#E8EDF2"}, "rooms": [{"name": "Office", "rect": [1, 1, 6, 7], "fill": "office"}, {"name": "Store", "rect": [6, 1, 11, 7]}], "openings": [{"wall": {"room": "Office", "edge": 1}, "at": 0.4, "width": 1.5}, {"a": [2, 7], "b": [4, 7]}]}}
```

In the Python builder the section is a keyword of `Model`:

```python
from nagasim import build as nb
m = nb.Model(building={'extent': [0, 0, 12, 8], 'palette': {'office': '#E8EDF2'}, 'rooms': [{'name': 'Office', 'rect': [1, 1, 6, 7], 'fill': 'office'}, {'name': 'Store', 'rect': [6, 1, 11, 7]}], 'openings': [{'wall': {'room': 'Office', 'edge': 1}, 'at': 0.4, 'width': 1.5}, {'a': [2, 7], 'b': [4, 7]}]})
```

## Used in

Bundled models: [Emergency department: bedside scan (film template)](../../gallery/services.md).

Guides: [Model file format](../../model-file-format.md).

## See also

- [All sections](index.md), [Model file keys](../schema.md), [Model file format](../../model-file-format.md)
