Skip to main content
placeDrawing puts a drawing in metres into a viewport on the page, in millimetres. The viewport sets the scale, the rotation and the aim. It can also set the paper size of the plan text with labelMm.

Import

Example

Notes

  • labelMm is a text height in paper millimetres, 1.8 or more. Room names and tags print at it at every scale. Room detail lines print at 0.7 of it, but never under 1.8 mm.
  • A viewport’s labelMm wins over the labelMm of its saved plan view, in that viewport only.
  • Markers and level labels keep their own size.
  • A project with a viewport labelMm under 1.8 does not open; the error names the path.

placeDrawing

Place a viewport’s VectorDrawing (model metres) into its frame (paper mm).

viewportTransform

The model→paper point transform for a viewport: model metres centred in the frame at viewport.scale, then turned by viewport.rotationDeg, counter-clockwise on the sheet.

inverseViewportTransform

Inverse of viewportTransform: map a paper-mm point back to model metres for the same viewport.

fitTransform

Compute the stage transform that fits a page into a viewport, centred.

fitViewportScale

The scale and aim that fit a drawing inside a frame, snapped to a real scale.

viewCenterOf

The model point that lands at the centre of the viewport’s frame.

viewportExtent

The box, in model metres, that a viewport at scale is fitted and centred on: the drawing’s bounds, grown to hold each paper-sized symbol (a door or window tag) at the size it prints at that scale, and without the site parts when centerOn is 'building'.

viewSourceToDrawingRequest

Map a viewport’s ViewSource to a core DrawingRequest.

modelToPaper

Model length (metres) → paper length (millimetres) at a drawing scale.

Types

DrawingExtent

What the viewport centre and fit read from a drawing: its bounds and, when it has them, its primitives.

SheetPolicy

Resolved once per sheet (and again per viewport that names its own style).
PaperStyle
required
The flattened style: no extends left, every layer merged.
string
required
'screen' | 'print' | 'both'
required
number
required
hashString(sheet.id) — the salt every hand stroke on this sheet shares.
string
required
Ink for model-anchored drawing.texts, which never pass through penFor.
string[]
required
Style ids, extends, hatch keys and colours that could not be resolved. Warned once per sheet; the render falls back rather than failing.

PlacedDrawing

A viewport’s drawing mapped into paper space (mm), ready to emit. The package does not export this type by name.
DrawingPrimitive[]
required
Standardized primitives in paper mm, with lineweight resolved.
VectorLine[]
required
VectorText[]
required
{ x: number; y: number; width: number; height: number; }
Clip rectangle (the viewport frame) when viewport.clip is set.
{ x: number; y: number; width: number; height: number; }[]
With clip: the paper box of each view-mark head (a paper-sized MARKER symbol, such as a section bubble) that reaches out of the frame. The clip holds these boxes too, so a mark at the edge of the crop prints whole; the model ink stays cut at the frame. Absent when every head is inside the frame.
PenContext
The style context the primitives were resolved under.

FitViewport

Viewport dimensions in screen pixels.

FitOptions

number
required
Layer scale — how many screen pixels one paper millimetre occupies at 1×.
number
required
Fraction of the viewport to fill, leaving breathing room.
number
required
number
required

FitTransform type

The stage transform that frames a page: uniform scale plus a top-left offset.
Last modified on November 30, 2026