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

# PlanDrawingExtractor

> PlanDrawingExtractor makes a plan drawing from live elements.

The plan shows the footprint of each element. It does not cut the building at a height.

## Import

```typescript theme={null}
import { PlanDrawingExtractor, assertPlanDrawingRequest } from '@opengeometry/floorkit';
```

## Example

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

export function extractLivePlan(elements: PlanVectorExportable[]) {
  const extractor = new PlanDrawingExtractor(elements);
  return extractor.extract({ view: 'top' });
}
```

## Notes

* The output uses metres.
* `entities` selects elements by id. Without it, all elements are drawn.
* The top view is the supported view. A request for a cut plan or a section throws an error.
* For a cut plan, a section or an elevation of a saved building, use [`drawProjectView`](/floorkit/api/drawings/draw-project-view).
* Start the geometry kernel before you create this object. See [`Floorkit`](/floorkit/api/runtime/floorkit).

**Inheritance:** `implements DrawingExtractor`

## Constructor

```typescript theme={null}
constructor(elements: PlanVectorExportable[], options?: {
    stairCutElevation?: number;
    roomLabels?: RoomLabelMode;
    openingTags?: OpeningTagMode;
    sourceByLiveId?: ReadonlyMap<string, BuildingSourceRef>;
});
```

## Methods

### extract

```typescript theme={null}
extract(req: DrawingRequest): VectorDrawing;
```

## assertPlanDrawingRequest

Shared validation for extractors that compose authored plan primitives.

```typescript theme={null}
function assertPlanDrawingRequest(req: DrawingRequest): void;
```

## Types

### BuildingSourceRef

```typescript theme={null}
type BuildingSourceRef =
  | ElementSourceRef
  | WallSegmentSourceRef
  | OpeningSourceRef
  | ModelObjectSourceRef;
```

### ElementSourceRef

Authored identity carried independently of a drawing primitive's visual style.

The package does not export this type by name.

```typescript theme={null}
interface ElementSourceRef {
  readonly kind: 'element';
  readonly modelId: string;
  readonly buildingId?: string;
  readonly storeyId?: string;
  readonly elementId: string;
  readonly massSegmentId?: string;
}
```

<ResponseField name="kind" type="'element'" required>
  A whole saved element: a slab, a room, a mass and the like.
</ResponseField>

<ResponseField name="modelId" type="string" required>
  The saved model.
</ResponseField>

<ResponseField name="buildingId" type="string">
  The building of the element; absent for an element of the site.
</ResponseField>

<ResponseField name="storeyId" type="string">
  The storey of the element; absent for an element of no storey, such as a mass.
</ResponseField>

<ResponseField name="elementId" type="string" required>
  The saved id of the element.
</ResponseField>

<ResponseField name="massSegmentId" type="string">
  The saved id of the part (segment) of the mass `elementId` that a plan region draws. Only the plan
  drawing of a mass sets it; the part resolves to its mass, and a press on it selects the part.
</ResponseField>

### WallSegmentSourceRef

The package does not export this type by name.

```typescript theme={null}
interface WallSegmentSourceRef {
  readonly kind: 'wall-segment';
  readonly modelId: string;
  readonly buildingId: string;
  readonly storeyId: string;
  readonly elementId: string;
  readonly segmentIndex: number;
  readonly startPointIndex: number;
  readonly endPointIndex: number;
}
```

<ResponseField name="kind" type="'wall-segment'" required />

<ResponseField name="modelId" type="string" required />

<ResponseField name="buildingId" type="string" required />

<ResponseField name="storeyId" type="string" required />

<ResponseField name="elementId" type="string" required>
  The saved wall run, shared by every compiled segment.
</ResponseField>

<ResponseField name="segmentIndex" type="number" required>
  Zero-based segment index in the saved wall run.
</ResponseField>

<ResponseField name="startPointIndex" type="number" required />

<ResponseField name="endPointIndex" type="number" required />

### OpeningSourceRef

The package does not export this type by name.

```typescript theme={null}
interface OpeningSourceRef {
  readonly kind: 'opening';
  readonly modelId: string;
  readonly buildingId: string;
  readonly storeyId: string;
  readonly elementId: string;
  readonly hostWallId?: string;
}
```

<ResponseField name="kind" type="'opening'" required />

<ResponseField name="modelId" type="string" required />

<ResponseField name="buildingId" type="string" required />

<ResponseField name="storeyId" type="string" required />

<ResponseField name="elementId" type="string" required />

<ResponseField name="hostWallId" type="string">
  Present only while the saved opening belongs to a wall run.
</ResponseField>

### ModelObjectSourceRef

A saved basic object; its current drawing can be inspected before an edit gesture exists.

The package does not export this type by name.

```typescript theme={null}
interface ModelObjectSourceRef {
  readonly kind: 'model-object';
  readonly modelId: string;
  readonly buildingId: string;
  readonly storeyId: string;
  readonly elementId: string;
}
```

## Related

* [`DrawingExtractor`](/floorkit/api/drawings/draw-project-view#drawingextractor)
* [`DrawingRequest`](/floorkit/api/drawings/draw-project-view#drawingrequest)
* [`OpeningTagMode`](/floorkit/api/annotations/room-and-opening-labels#openingtagmode)
* [`PlanVectorExportable`](/floorkit/api/shapes/cylinder-shape#planvectorexportable)
* [`RoomLabelMode`](/floorkit/api/annotations/room-and-opening-labels#roomlabelmode)
* [`VectorDrawing`](/floorkit/api/drawings/draw-project-view#vectordrawing)


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