> ## 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.

# Add a chimney

> Stand a chimney stack with its breast and pots in a storey, and let it cut every roof it passes through.

A chimney is a stack with an optional breast inside the house and pots on top. It stands in a storey, and its stack cuts each roof of its building that it passes through, on any storey.

[Live example](https://floorkit-examples.ploterr.com/floorkit/guides/add-a-chimney?embed=1)

## Before you start

You have the house of [Add a roof](https://docs.ploterr.com/floorkit/guides/add-a-roof.md): a room of walls with a floor slab and a gable roof whose ridge runs along x at z 2.

## Write the chimney

This chimney stands against the east gable wall, whose outer face is at x 6.1. The stack is 0.5 by 0.6 metres and rises from the ground to 5.1 metres, more than 0.6 metres above the ridge. The breast is the wider part inside the room, 2.6 metres high. Two pots stand on the stack.

```typescript theme={null}
import type { BmChimney, BuildingSession } from '@opengeometry/floorkit';

export const gableChimney: BmChimney = {
  id: 'gable-chimney',
  stack: {
    outerRing: [
      [5.6, 1.7],
      [6.1, 1.7],
      [6.1, 2.3],
      [5.6, 2.3],
    ],
  },
  baseOffset: 0,
  height: 5.1,
  breast: {
    profile: {
      outerRing: [
        [5.45, 1.4],
        [6.1, 1.4],
        [6.1, 2.6],
        [5.45, 2.6],
      ],
    },
    height: 2.6,
  },
  pots: { count: 2, diameter: 0.2, height: 0.4 },
};
```

## Cap the stack

A `cap` finishes the top of the stack. An `oversailing` cap is a band of courses that stands out of every face near the top; a `slab` cap is a capping slab on the top, and the pots stand on it. This stack has one course 0.04 metres out and 0.225 metres deep, its top 0.075 metres under the top of the stack.

```typescript theme={null}
export const cappedChimney: BmChimney = {
  ...gableChimney,
  cap: { kind: 'oversailing', projection: 0.04, depth: 0.225, below: 0.075 },
};
```

## Add it to the storey

A chimney is an entry in the `chimneys` list of its storey.

```typescript theme={null}
export function addChimney(session: BuildingSession): void {
  session.apply(
    {
      kind: 'add-element',
      buildingId: 'building',
      storeyId: 'ground',
      list: 'chimneys',
      element: gableChimney,
    },
    session.revision,
  );
}
```

The session builds the chimney and cuts the stack out of the roof. `replace-element` changes it and `remove-element` takes it away; the roof gets its slope back.

```typescript theme={null}
export function replaceChimney(session: BuildingSession, chimney: BmChimney): void {
  session.apply(
    {
      kind: 'replace-element',
      buildingId: 'building',
      storeyId: 'ground',
      list: 'chimneys',
      elementId: chimney.id,
      element: chimney,
    },
    session.revision,
  );
}

export function removeChimney(session: BuildingSession): void {
  session.apply(
    {
      kind: 'remove-element',
      buildingId: 'building',
      storeyId: 'ground',
      list: 'chimneys',
      elementId: gableChimney.id,
    },
    session.revision,
  );
}
```

## Rules

* `stack` and `breast.profile` are plan outlines in world x and z, outer rings only (`chimney-with-holes`). `baseOffset` is the metres from the storey elevation to the foot of the chimney, and `height` the metres from there to the top of the stack, pots not included.
* The breast stands from the foot of the chimney up `breast.height` metres, below the top of the stack (`breast-above-stack`). Where the stack stands inside the breast, the breast is built around it, so the two bodies touch and do not overlap.
* `pots` stand in a row along the longest side of the stack, spread evenly over its length. `count` is 0 to 6 (`bad-pots`); the default is one pot 0.2 metres across and 0.6 metres high. A count of 0 gives no pots.
* `cap.kind` is `oversailing` or `slab` (`bad-cap-kind`); `projection` and `depth` are metres above zero (`bad-cap`). The ring of a cap is the stack outline moved out by `projection`. An oversailing cap takes `courses`, 1 to 3 (default 1, `bad-cap`): each course is `depth` deep and `projection` further out than the one under it, and the top course is `below` metres (default 0) under the top of the stack. The courses must stay on the stack (`cap-below-stack`). A slab is `depth` thick on the top of the stack and takes no `below` or `courses` (`cap-field-not-for-kind`). With no `cap` the stack has none.
* The stack cuts each roof of its building that it passes through by area, on its own storey or on any other. A roof it only touches at an edge is not cut. The breast cuts no roof, and a chimney cuts no slab: give a slab a hole for it.
* A plan cuts the breast and the stack where its cut plane passes through them, as poché, on the plan of the chimney's storey and on the plans of the storeys above it.
* The roof plan draws the outline of the stack, the outline of its cap and its pots on each roof that it cuts. The ridge, the hips and the valleys stop at the stack, and so does an eave line that the stack stands across. A floor plan draws no stack on a roof below its cut.
* Elevations see the stack, the breast, the cap and the pots, and sections cut them. A face of the chimney that lies flush with a wall face draws no line on the wall: the stack shows where it rises past the roof.
* A chimney cuts a roof only when the two stand together: a demolished chimney cuts no new roof, a new chimney cuts no demolished roof, and an existing chimney cuts both.
* A chimney is its own element: its drawings take its own `phase`, and a roof plan or an elevation of the existing state draws an existing or a demolished chimney.
* An edit of a chimney builds it again with the roofs that it passes through, before and after the edit. An edit of a roof builds that roof again, cut by the chimneys that pass through it. No other element is built again.

## Next

> [card] [Add a roof](https://docs.ploterr.com/floorkit/guides/add-a-roof.md)
>
> Pitches, edge kinds, rooflights and dormers.

> [card] [Draw the existing and the proposed state](https://docs.ploterr.com/floorkit/guides/existing-and-proposed.md)
>
> Mark a chimney to be removed.


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