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

# drawProjectView

> drawProjectView makes the vector drawing of one saved view: a plan, a section or an elevation.

The drawing is a list of lines, arcs, regions and text in metres.

## Import

```typescript theme={null}
import {
  drawProjectView,
  drawProjectViewFromBuild,
  ProjectDrawingError,
} from '@opengeometry/floorkit';
```

## Example

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

export function currentDrawing(project: ProjectFile, viewId: string, session: BuildingSession) {
  const current: ProjectFile = { ...project, buildingModel: session.snapshot() };
  return drawProjectViewFromBuild(current, viewId, session.currentBuild);
}
```

## Notes

* `drawProjectView` builds a temporary copy of the building. `drawProjectViewFromBuild` uses the build of a session that is open, which is faster.
* With `drawProjectViewFromBuild`, put `session.snapshot()` into the project first.
* A plan cuts straight walls at the cut height of the view.
* If Floorkit cannot draw a view, it throws `ProjectDrawingError` with a `code`. It does not draw a footprint in place of a cut.

## Signature

```typescript theme={null}
function drawProjectView(
  project: ProjectFile,
  viewId: string,
  options?: DrawProjectViewOptions,
): VectorDrawing;
```

## Parameters

<ParamField path="project" type="ProjectFile" required />

<ParamField path="viewId" type="string" required />

<ParamField path="options" type="DrawProjectViewOptions">
  Default: `&#123;&#125;`.
</ParamField>

## Returns

```typescript theme={null}
VectorDrawing;
```

## drawProjectViewFromBuild

Draw a saved view from an existing compilation without rebuilding its geometry.

```typescript theme={null}
function drawProjectViewFromBuild(
  project: ProjectFile,
  viewId: string,
  built: BuildResult,
  options?: DrawProjectViewOptions,
): VectorDrawing;
```

## ProjectDrawingError

```typescript theme={null}
class ProjectDrawingError extends Error {
  readonly code: ProjectDrawingErrorCode;
  readonly viewId: string;
  constructor(code: ProjectDrawingErrorCode, viewId: string, message: string);
}
```

## Types

### VectorDrawing

Plain-data vector drawing returned by a DrawingExtractor.

```typescript theme={null}
interface VectorDrawing {
  units: 'meters';
  bounds: PlanVectorBounds;
  primitives: DrawingPrimitive[];
  texts?: VectorText[];
}
```

<ResponseField name="units" type="'meters'" required />

<ResponseField name="bounds" type="PlanVectorBounds" required />

<ResponseField name="primitives" type="DrawingPrimitive[]" required>
  The standardized drawing geometry.
</ResponseField>

<ResponseField name="texts" type="VectorText[]">
  Optional model-anchored labels (e.g. from the kernel projection path).
</ResponseField>

### DrawProjectViewOptions

```typescript theme={null}
interface DrawProjectViewOptions {
  assetSources?: BuildOptions['assetSources'];
  massColors?: BuildOptions['massColors'];
}
```

<ResponseField name="assetSources" type="BuildOptions['assetSources']" />

<ResponseField name="massColors" type="BuildOptions['massColors']">
  The colours of mass parts by use; see `BuildOptions.massColors`.
</ResponseField>

### ProjectDrawingErrorCode

```typescript theme={null}
type ProjectDrawingErrorCode =
  | 'inconsistent-build'
  | 'unknown-view'
  | 'unknown-storey'
  | 'unknown-element'
  | 'unsupported-element'
  | 'empty-filter'
  | 'empty-view'
  | 'unsupported-visible-range'
  | 'unsupported-view';
```

### PlanVectorBounds

```typescript theme={null}
interface PlanVectorBounds {
  min: PlanVectorPoint;
  max: PlanVectorPoint;
  width: number;
  height: number;
}
```

### VectorExtractable

Implemented by model elements that can be drawn into a paper viewport — the three-free successor to `PlanVectorExportable.getExportRoots()`.

```typescript theme={null}
interface VectorExtractable {
  getBrepEntities(): BrepEntity[];
}
```

### DrawingSourceRef

A drawing hit may identify a saved feature without granting an edit gesture.

```typescript theme={null}
type DrawingSourceRef = BuildingSourceRef & {
  readonly interaction: 'selectable' | 'inspect-only';
};
```

### VectorLine

A projected line segment.

```typescript theme={null}
type VectorLine = PlanVectorLine;
```

### DrawingView

Views the extractor can project.

```typescript theme={null}
type DrawingView = 'top' | 'front' | 'right' | 'left' | 'back' | 'iso';
```

### VectorText

A model label/tag projected as vector text (paper renders it natively).

```typescript theme={null}
interface VectorText {
  position: Point2;
  text: string;
  height: number;
  paperHeightMm?: number;
  rotationDeg?: number;
}
```

<ResponseField name="position" type="Point2" required />

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

<ResponseField name="height" type="number" required>
  Text height in model units (meters).
</ResponseField>

<ResponseField name="paperHeightMm" type="number">
  Paper millimetres, overriding height at placement — see DrawingText.paperHeightMm.
</ResponseField>

<ResponseField name="rotationDeg" type="number" />

### VectorArc

An optional projected arc segment.

```typescript theme={null}
interface VectorArc {
  center: Point2;
  radius: number;
  startAngleDeg: number;
  endAngleDeg: number;
  stroke_width?: number;
  stroke_color?: PlanVectorColor;
}
```

### DrawingRequest

Describes what a single viewport draws from model space.

```typescript theme={null}
interface DrawingRequest {
  view: DrawingView;
  cut?: {
    elevation?: number;
    sectionId?: string;
  };
  camera?: ProjectionCamera;
  hlr?: PlanProjectionHlr;
  entities?: string[] | 'all';
  labelMm?: number;
}
```

<ResponseField name="view" type="DrawingView" required />

<ResponseField
  name="cut"
  type="{
elevation?: number;
sectionId?: string;
}"
>
  Plan cut-plane elevation, or the section/elevation line id.
</ResponseField>

<ResponseField name="camera" type="ProjectionCamera">
  Required for `view: 'iso'`.
</ResponseField>

<ResponseField name="hlr" type="PlanProjectionHlr" />

<ResponseField name="entities" type="string[] | 'all'">
  Which model entities to include, or `'all'`.
</ResponseField>

<ResponseField name="labelMm" type="number">
  Print every text primitive at this height in paper millimetres, regardless of the sheet scale —
  stamped onto each as DrawingText.paperHeightMm. Without it a consumer has to rewrite each
  element's `fontSize` before extracting, which mutates the model to change a drawing and reaches
  only the element types it knows about.
</ResponseField>

### DrawingExtractor

Headless, three-free extraction API.

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

### DrawingLoop

An ordered, implicitly-closed ring of points.

```typescript theme={null}
type DrawingLoop = Point2[];
```

### DrawingFill

Region fill (poché) descriptor.

```typescript theme={null}
interface DrawingFill {
  color?: PlanVectorColor;
  pattern?: 'solid' | 'hatch';
}
```

### DrawingStyle

```typescript theme={null}
interface DrawingStyle {
  role?: 'cut' | 'silhouette' | 'projected' | 'hidden' | 'datum' | 'marker';
  ogType?: string;
  ogid?: string;
  subId?: string;
  outlineGroup?: string;
  stroke?: {
    color?: PlanVectorColor;
    width?: number;
  };
  fill?: DrawingFill;
  outline?: boolean;
  edgeClass?: string;
}
```

<ResponseField name="role" type="'cut' | 'silhouette' | 'projected' | 'hidden' | 'datum' | 'marker'">
  Physical drawing meaning; paper/renderers resolve its print appearance.
</ResponseField>

<ResponseField name="ogType" type="string">
  Source element type ("WALL"|"DOOR"|...) → app-side lineweight + fill policy.
</ResponseField>

<ResponseField name="ogid" type="string">
  Source element instance id. Stamped by the extractor so an interactive 2D renderer can map a
  picked primitive back to its element (`getElementById(ogid)` → `getEditAnchors()`). Unset on the
  export-only path.
</ResponseField>

<ResponseField name="subId" type="string">
  Optional sub-feature id within the source element (e.g. "edge:2", "v:outer:3") for finer-grained
  editing/hit-testing. Producers set this when they emit per-feature primitives; element-level
  picking only needs `ogid`.
</ResponseField>

<ResponseField name="outlineGroup" type="string">
  The joined wall group that an outline line bounds: the id of its first wall and the index of that
  wall's cut region.
</ResponseField>

<ResponseField
  name="stroke"
  type="{
color?: PlanVectorColor;
width?: number;
}"
/>

<ResponseField name="fill" type="DrawingFill">
  Region fill (poché). Unset unless a producer or fill policy assigns it.
</ResponseField>

<ResponseField name="outline" type="boolean">
  `false` draws a region's fill WITHOUT its own outline. Set when the outline is drawn separately:
  merged wall poché emits the boundary of the joined mass as `line` primitives, so each wall's own
  ring must not be stroked or every junction seam comes back. Ignored by the other primitive kinds,
  which are outlines already.
</ResponseField>

<ResponseField name="edgeClass" type="string">
  Kernel HLR edge class, carried verbatim from projection (e.g. "VisibleOutline" | "Hidden" |
  "VisibleCrease"). Unset for authored 2D (plan) primitives. Lets the renderer dash hidden edges,
  etc.
</ResponseField>

### DrawingPrimitiveSource

```typescript theme={null}
interface DrawingPrimitiveSource {
  sourceRef?: DrawingSourceRef;
  sourceRefs?: readonly DrawingSourceRef[];
}
```

<ResponseField name="sourceRef" type="DrawingSourceRef">
  Authored identity for selection; absent when the drawing cannot attribute a source.
</ResponseField>

<ResponseField name="sourceRefs" type="readonly DrawingSourceRef[]">
  Multiple authored owners of merged material. No arbitrary single editable owner.
</ResponseField>

### DrawingLine

```typescript theme={null}
interface DrawingLine extends DrawingPrimitiveSource {
  kind: 'line';
  start: Point2;
  end: Point2;
  style?: DrawingStyle;
}
```

### DrawingArc

```typescript theme={null}
interface DrawingArc extends DrawingPrimitiveSource {
  kind: 'arc';
  center: Point2;
  radius: number;
  startAngleDeg: number;
  endAngleDeg: number;
  style?: DrawingStyle;
}
```

### DrawingBoundary

```typescript theme={null}
type DrawingBoundary = DrawingLine | DrawingArc;
```

### DrawingCurvedRegion

```typescript theme={null}
interface DrawingCurvedRegion extends DrawingPrimitiveSource {
  kind: 'curvedRegion';
  outer: DrawingBoundary[];
  holes: DrawingBoundary[][];
  style?: DrawingStyle;
}
```

### DrawingRegion

```typescript theme={null}
interface DrawingRegion extends DrawingPrimitiveSource {
  kind: 'region';
  outer: DrawingLoop;
  holes: DrawingLoop[];
  style?: DrawingStyle;
}
```

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

<ResponseField name="outer" type="DrawingLoop" required>
  Outer boundary ring.
</ResponseField>

<ResponseField name="holes" type="DrawingLoop[]" required>
  Inner rings (holes) — even-odd voids, e.g. door/window openings in a wall.
</ResponseField>

<ResponseField name="style" type="DrawingStyle" />

### DrawingText

```typescript theme={null}
interface DrawingText extends DrawingPrimitiveSource {
  kind: 'text';
  position: Point2;
  text: string;
  align?: 'left' | 'center' | 'right';
  height: number;
  paperHeightMm?: number;
  rotationDeg?: number;
  style?: DrawingStyle;
}
```

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

<ResponseField name="position" type="Point2" required />

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

<ResponseField name="align" type="'left' | 'center' | 'right'">
  Horizontal alignment at position; omitted preserves centered text.
</ResponseField>

<ResponseField name="height" type="number" required>
  Text height in model units (meters).
</ResponseField>

<ResponseField name="paperHeightMm" type="number">
  Text height in PAPER millimetres, overriding height at placement.
</ResponseField>

<ResponseField name="rotationDeg" type="number" />

<ResponseField name="style" type="DrawingStyle" />

### DrawingPolyline

An open or closed run of straight segments through `points` (back to the first when `closed`).

```typescript theme={null}
interface DrawingPolyline extends DrawingPrimitiveSource {
  kind: 'polyline';
  points: Point2[];
  closed?: boolean;
  style?: DrawingStyle;
}
```

### DrawingPrimitive

```typescript theme={null}
type DrawingPrimitive =
  | DrawingLine
  | DrawingArc
  | DrawingRegion
  | DrawingCurvedRegion
  | DrawingText
  | DrawingPolyline;
```

### PlanVectorLine

```typescript theme={null}
interface PlanVectorLine {
  start: PlanVectorPoint;
  end: PlanVectorPoint;
  stroke_width?: number;
  stroke_color?: PlanVectorColor;
  ogType?: string;
}
```

<ResponseField name="start" type="PlanVectorPoint" required />

<ResponseField name="end" type="PlanVectorPoint" required />

<ResponseField name="stroke_width" type="number" />

<ResponseField name="stroke_color" type="PlanVectorColor" />

<ResponseField name="ogType" type="string">
  Source element type (e.g. "WALL"), for app-side lineweight policy.
</ResponseField>

## Related

* [`BrepEntity`](/floorkit/api/drawings/kernel-drawing-extractor#brepentity)
* [`BuildingSourceRef`](/floorkit/api/drawings/plan-drawing-extractor#buildingsourceref)
* [`BuildOptions`](/floorkit/api/architecture/build-from-building-model#buildoptions)
* [`BuildResult`](/floorkit/api/architecture/build-from-building-model#buildresult)
* [`PlanProjectionHlr`](/floorkit/api/drawings/drawing-helpers#planprojectionhlr)
* [`PlanVectorColor`](/floorkit/api/annotations/dimension-geometry#planvectorcolor)
* [`PlanVectorPoint`](/floorkit/api/annotations/dimension-geometry#planvectorpoint)
* [`Point2`](/floorkit/api/annotations/dimension-geometry#point2)
* [`ProjectFile`](/floorkit/api/exports/project-file#projectfile)
* [`ProjectionCamera`](/floorkit/api/drawings/sheet-documents#projectioncamera)


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