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

# Cut a section

> Save a vertical cut through the building, or an outside elevation.

export const LiveExample = ({path, title = 'Live example', height = 460}) => {
  return <Frame>
      <iframe src={`https://floorkit-examples.ploterr.com/floorkit/${path}?embed=1`} ref={frame => {
    if (!frame || !['localhost', '127.0.0.1'].includes(window.location.hostname)) return;
    const local = `http://localhost:5555/${path}?embed=1`;
    if (frame.src !== local) frame.src = local;
  }} title={title} loading="lazy" allow="fullscreen" style={{
    width: '100%',
    height: `${height}px`,
    border: 0,
    display: 'block'
  }} />
    </Frame>;
};

A section is a vertical cut along a line. An elevation is a view of the building from outside. You save where to cut and where to look. Floorkit makes the linework from the model.

<LiveExample path="guides/cut-a-section" />

## Before you start

You have a project from [Create a plan view](/floorkit/guides/create-a-plan-view).

## Save a section

This section cuts the building along the line from `[4.5, -1]` to `[4.5, 5]`. The line goes through the window and across the roof ridge. The view looks to the right of that line, to the door, and shows 5 metres of depth.

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

export const sectionA: SavedDrawingView = {
  id: 'section-a',
  name: 'Section A',
  kind: 'section',
  line: { start: [4.5, -1], end: [4.5, 5] },
  lookSide: 'right',
  depth: 5,
  verticalCrop: { minY: -0.5, maxY: 6 },
  settings: { levelLabels: { datum: 0, unit: 'm' } },
};
```

| Field | Meaning |
| - | - |
| `line` | The cut line, as two `[x, z]` points |
| `lookSide` | The side that you look to, when you go from start to end |
| `depth` | How far the view shows behind the cut, in metres |
| `verticalCrop` | The lowest and the highest world height that the view shows |
| `settings.levelLabels` | Adds the name and the height of each storey. `datum` is the height that is zero |

## Save an elevation

This elevation looks at the south face. The `origin` is 2 metres in front of the building, and `lookDirection` points to the building.

```typescript theme={null}
export const southElevation: SavedDrawingView = {
  id: 'elevation-south',
  name: 'South elevation',
  kind: 'elevation',
  origin: [3, -2],
  lookDirection: [0, 1],
  crop: { left: -4, right: 4, bottom: -6, top: 0.5 },
};
```

The crop is in the frame of the view, in metres from the `origin`. In that frame the vertical axis points down. Thus `bottom: -6` keeps 6 metres above the zero height, and `top: 0.5` keeps 0.5 metres below it.

## Add the views to the project

```typescript theme={null}
export function addSectionViews(project: ProjectFile): ProjectFile {
  return { ...project, version: 3, views: [...project.views, sectionA, southElevation] };
}
```

Then draw a view with `drawProjectView(project, 'section-a')`, or put it on a sheet.

## Show the cut on the plan

A mark on the plan shows where the section cuts. You save which plan gets the mark and which view it points to. Floorkit takes the line from the section, so the mark moves when you change the section.

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

export const sectionMark: ProjectViewMarker = {
  id: 'section-a-mark',
  kind: 'source',
  parentViewId: 'ground-plan',
  target: { viewId: 'section-a' },
};

export function addSectionMark(project: ProjectFile): ProjectFile {
  return { ...project, version: 3, markers: [...(project.markers ?? []), sectionMark] };
}
```

The text of the mark is `[unplaced] Section A` until the section is on a sheet. [Compose a sheet](/floorkit/guides/compose-a-sheet#number-the-section-mark) gives it a drawing number.

## Rules

* Draw the cut line fully across the building. Start and end it outside the walls.
* Keep the cut line and the far limit of the view away from wall faces, from the edges of openings and from the roof ridge. Floorkit rejects a view when one of its limits only touches a face or lies along an edge. Move the line, or change `depth`, by some centimetres.
* An open door reaches one door width out of its wall. Include that distance when you set `depth`.
* A level label is at the left of the view, outside the crop. Give the view some empty width on that side when you put it on a sheet.
* A section uses a straight line. An elevation looks from outside the building.
* If Floorkit cannot draw the view, `drawProjectView` throws `ProjectDrawingError` with a `code`.

## Next

<CardGroup cols={2}>
  <Card title="Compose a sheet" icon="file-lines" href="/floorkit/guides/compose-a-sheet">
    Put the section next to the plan.
  </Card>

  <Card title="Marks and level labels API" icon="code" href="/floorkit/api/drawings/view-markers-and-level-labels">
    See each field of a mark.
  </Card>
</CardGroup>


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