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

# Make a curtain wall

> Turn a wall into a grid of mullions, transoms and glass.

A curtain wall is a wall with a `curtain` grid. It keeps its points, its joins and its doors, so you draw it, move it and join it as any other wall. Floorkit builds mullions, transoms and panels in place of a solid body.

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

## Before you start

You have a session from [Start a building](https://docs.ploterr.com/floorkit/guides/start-a-building.md). This guide draws a small shop: three solid walls and a glass front with a door.

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

export function drawShop(session: BuildingSession): void {
  session.apply(
    {
      kind: 'batch',
      commands: [
        {
          kind: 'create-wall',
          buildingId: 'building',
          storeyId: 'ground',
          wall: {
            id: 'shop-walls',
            points: [
              [0, 0],
              [0, 5],
              [8, 5],
              [8, 0],
            ],
            thickness: 0.3,
          },
        },
        {
          kind: 'create-wall',
          buildingId: 'building',
          storeyId: 'ground',
          wall: {
            id: 'shopfront',
            points: [
              [0, 0],
              [8, 0],
            ],
            thickness: 0.15,
            material: 'GLASS',
          },
        },
      ],
    },
    session.revision,
  );
  session.apply(
    {
      kind: 'add-hosted-opening',
      buildingId: 'building',
      storeyId: 'ground',
      wallId: 'shopfront',
      opening: { id: 'entrance', kind: 'door', offset: 4, width: 1.8, height: 2.1 },
    },
    session.revision,
  );
}
```

## Make the wall a curtain wall

`replace-wall-settings` replaces all the settings of the wall, so read the settings it has and add `curtain`. This grid has bays no wider than 1.5 metres and one transom 2.5 metres above the base of the wall.

```typescript theme={null}
function settingsOf(session: BuildingSession, wallId: string): BmWallSettings {
  const wall = session
    .snapshot()
    .buildings[0].storeys[0].walls?.find((candidate) => candidate.id === wallId);
  if (!wall) throw new Error(`no wall ${wallId}`);
  const { id: _id, points: _points, closed: _closed, openings: _openings, ...settings } = wall;
  return settings;
}

export function makeCurtainWall(session: BuildingSession): void {
  session.apply(
    {
      kind: 'replace-wall-settings',
      buildingId: 'building',
      storeyId: 'ground',
      wallId: 'shopfront',
      settings: {
        ...settingsOf(session, 'shopfront'),
        material: 'GLASS',
        curtain: {
          divisions: { kind: 'maxSpacing', maxSpacing: 1.5 },
          transoms: [2.5],
        },
      },
    },
    session.revision,
  );
}
```

## Make it a plain wall again

Apply its settings without `curtain`. Each change is one undo step.

```typescript theme={null}
export function makePlainWall(session: BuildingSession): void {
  const { curtain: _curtain, ...settings } = settingsOf(session, 'shopfront');
  session.apply(
    {
      kind: 'replace-wall-settings',
      buildingId: 'building',
      storeyId: 'ground',
      wallId: 'shopfront',
      settings,
    },
    session.revision,
  );
}
```

## The grid

| Field | What it does |
| - | - |
| `divisions` | How the wall is cut into bays: `{ kind: 'spacing', spacing, justify? }`, `{ kind: 'maxSpacing', maxSpacing }`, `{ kind: 'count', bays }` or `{ kind: 'positions', offsets }`. `offsets` are distances along the wall from its first point, as the `offset` of a door. |
| `transoms` | Heights of the transoms above the base of the wall, going up. The sill and the head are always there. |
| `mullion` | `{ width, depth }` of every mullion and transom. The default is 0.05 m wide and as deep as the wall, up to 0.15 m. The depth can be no more than the wall thickness. |
| `panelThickness` | The thickness of each panel. The default is 0.024 m. |
| `spandrelRows` | Rows, counted from 0 at the bottom, that have an opaque spandrel panel in place of glass. |
| `frameColor` | The colour of the mullions and transoms, as `"#rrggbb"`. The default is the frame colour of a window. |
| `glassColor` | The colour of the glass panels, as `"#rrggbb"`. The default is the pane colour of a window. Spandrels take the wall `color`. |
| `cornerMullion` | `true` makes one mullion where this wall and another curtain wall both end at an L corner, in place of an end member from each wall. Either wall can ask for it. Each wall can be straight or an arc. Both walls must have the same height and base; at a T, an X or a continuation it is ignored. |

## Rules

* The first and the last mullion stand at the faces of the walls that the curtain wall joins. The ends of the curtain wall have the same shape as the ends of a plain wall.
* Two mullions closer than one mullion width become one.
* On a straight wall divided by `spacing`, `maxSpacing` or `count`, the grid leaves no bay narrower than two mullion widths: a grid mullion that would make one is left out, and the bays beside it become one. Mullions placed with `positions`, and the grid of a curved wall, are kept as they are.
* A curtain wall that stands on another curtain wall of the storey below, on the same line, shares the storey line with it: the lower wall keeps its head, and the upper wall has no sill over each bay that the lower head covers from end to end, so one member marks the storey line there. A bay the lower head covers only in part keeps its sill. Where the mullions of the two walls line up, they meet at the storey line. This holds for straight walls; a lower wall that follows a roof is not counted.
* A door in a curtain wall gets a mullion at each side and a transom above it. The grid stops at the door. Above the door, the grid rows continue.
* A window or a void in a curtain wall is refused with `curtain-hosts-doors-only`. A door too tall for its transom and the head is refused with `curtain-door-too-tall`.
* On a curved wall each bay is a flat panel. A bay that would stand out of the wall, the bay over a door included, is refused with `curtain-bay-off-arc`, and the message gives the widest bay that fits.
* A colour that is not `"#rrggbb"` is refused with `bad-color`. Every problem of a grid is reported, not only the first.
* A curtain wall with `topFollowsRoof` follows the roof. The grid keeps the wall's own height, with its head there. Where the roof underside rises above the head, the mullions go up to it and a row of panels fills the space above the head. Each mullion and panel is cut to the roof underside, as a plain wall is. A transom that the roof crosses is cut too, and a transom above the roof line, the head included, is left out. Where no roof covers the wall, it keeps its own height.
* While you drag a curtain wall, it shows as a plain wall. The grid is built again when you release it.
* A curtain wall has no layers. A wall with `typeRef` and a `curtain` grid is refused with `curtain-wall-type`. A wall with a wall type that meets a curtain wall joins it as one band of the curtain wall's material.

## In drawings and exports

* In a plan the mullions are cut material and join the walls next to them. The glass and the spandrels are lines, with `subId` `glazing` or `spandrel`.
* In 3D each part is its own body. `wall.getCurtainParts()` gives each body with its role: `mullion`, `transom`, `spandrel` or `glazing`.
* In sections and elevations, the glass does not hide what is behind it.
* An inspector edits the grid with one control: `Wall.editableSchema()` has the prop `curtain` with control kind `curtain`, which the host draws itself, as it does `propertySets`. `ProjectManager.replaceFields(liveId, { curtain })` saves it as one `replace-wall-settings` step, with the same checks.
* IFC export writes an `IfcCurtainWall` that aggregates an `IfcMember` (`MULLION`) for each mullion and transom and an `IfcPlate` (`CURTAIN_PANEL`) for each panel.

## Next

* [Add a door](https://docs.ploterr.com/floorkit/guides/add-a-door.md)
* [Undo and redo](https://docs.ploterr.com/floorkit/guides/undo-and-redo.md)


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