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

# Round a slab corner

> Turn a sharp corner of a slab into a true arc and read the exact floor area.

A slab corner can be a tangent arc instead of a point. You give a radius for the corner, and the area, the plan, the 3D body and the IFC export follow the curve.

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

## Before you start

You have a session from [Start a building](https://docs.ploterr.com/floorkit/guides/start-a-building.md). You know how to [add a floor slab](https://docs.ploterr.com/floorkit/guides/add-a-floor-slab.md).

## Write the slab

This page uses its own slab: a square of 4 metres by 4 metres, with the id `round-slab`. Its area is 16 square metres.

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

export const roundSlab: BmSlab = {
  id: 'round-slab',
  role: 'slab',
  profile: {
    outerRing: [
      [0, 0],
      [4, 0],
      [4, 4],
      [0, 4],
    ],
  },
  thickness: 0.2,
  baseOffset: -0.2,
};

export function addRoundSlab(session: BuildingSession): void {
  session.apply(
    {
      kind: 'add-element',
      buildingId: 'building',
      storeyId: 'ground',
      list: 'slabs',
      element: roundSlab,
    },
    session.revision,
  );
}
```

## Round one corner

The `set-corner-radius` command takes the list of the element, the id of the element, the ring (`'outer'` or the index of a hole), the corners and a radius in metres. The corners are indices of the points of the ring. One command is one undo step.

```typescript theme={null}
export function setRadius(
  session: BuildingSession,
  corners: number[],
  radius: number | null,
): void {
  session.apply(
    {
      kind: 'set-corner-radius',
      buildingId: 'building',
      storeyId: 'ground',
      list: 'slabs',
      elementId: 'round-slab',
      ring: 'outer',
      corners,
      radius,
    },
    session.revision,
  );
}

export function roundOneCorner(session: BuildingSession): void {
  setRadius(session, [0], 1);
}
```

A radius of 1 metre takes away `(1 - π/4) × r²`, which is 0.2146 square metres, from the corner.

## Round all four corners

Give the four indices in one command.

```typescript theme={null}
export function roundAllCorners(session: BuildingSession): void {
  setRadius(session, [0, 1, 2, 3], 1);
}
```

## Make the corners sharp again

A radius of `null` makes the corners sharp. The slab is the square again.

```typescript theme={null}
export function makeSharp(session: BuildingSession): void {
  setRadius(session, [0, 1, 2, 3], null);
}
```

## Read the exact area

`storeyFloorAreas` measures the slabs of a storey and counts each arc exactly. The walls do not count when the storey has a slab.

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

export function slabArea(session: BuildingSession): number {
  const storeys = session.snapshot().buildings[0].storeys;
  return storeyFloorAreas(storeys)[0].grossFloorArea;
}
```

The area is 16 square metres with sharp corners, 15.7854 with one corner of 1 metre, and 15.1416 with all four. A square of 4 metres loses `4 × 0.2146 = 0.8584` square metres.

## What is refused

The model has the radius in `cornerRadii.outerRing`, with one entry for each corner of `profile` and `null` for a sharp corner. `cornerRadii.holes[i]` does the same for hole `i`. The kernel refuses a radius in two cases:

* **The radius does not fit.** The two corners at the ends of an edge share that edge. The command is refused with `corner-radius-too-big`, and the message names the corner and the largest radius that fits. On a 4 metre edge, two corners of 2 metres give a half-round end, and two corners of more than 2 metres do not fit.
* **The corner is beside an arc edge.** A corner next to an edge from `arcs` takes no radius, and the command is refused with `corner-radius-arc-edge`.

A corner that you drag keeps its radius, and the radius shrinks to fit if it must.

## Round a corner in the plan editor

In the reshape mode of the plan, each slab corner has a round-corner handle on its bisector.

* Drag the handle to set a radius. The radius is limited to the largest that fits, and the plan shows it in millimetres.
* Type a number in millimetres and press Enter for an exact value.
* Drag the handle back onto the corner to make it sharp.

The inspector has the rows **Corner radius** and **All corners**. They take metres, and 0 clears the radius.

## Next

> [card] [Add a floor slab](https://docs.ploterr.com/floorkit/guides/add-a-floor-slab.md)
>
> Outline, thickness, edge profile and curved edges.

> [card] [Slab API](https://docs.ploterr.com/floorkit/api/architecture/slab.md)
>
> See each option of a slab.


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