Skip to content
Shapemetry

Model - Sheets

API reference for src/lanes/sheets/sheets, src/schema/sheets on @huukhanhnguyen/model, reachable from ..

See the Guide for the ModelJSON / evaluate pipeline.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

contentFill

function

Fraction of area the entities cover — the minContentFill measurement.

contentFill(entities: Entity[], area: BoundingBox2d): number

drawingIndexEntities

function

drawingIndexEntities(sheets: { key: string; title: string; }[], size: { width: number; height: number; }, titleBlock: TitleBlockInfo): Resolved<SheetValue>

paperSizeName

function

paperSizeName(size: { width: number; height: number; }): string

resolveSheet

function

Compose one sheet into flat sheet-space entities. See the module doc for the coordinate convention and the SheetResolveOptions contract.

resolveSheet(scene: Entity[], sheet: Sheet, options?: SheetResolveOptions): Resolved<SheetValue>

resolveSheetParams

function

Read sheet paper/scale from parameters[] (literal primary-arg values), falling back to the builtins. Same activation-by-declaration law every lane builtin follows (resolveLaneBuiltins), plus the two sheet-local rules: paper must be positive, and scale widens to a number.

resolveSheetParams(sheet: Sheet): { paperWidth: number; paperHeight: number; scale: number | "auto"; }

scaleCandidates

function

Standard drawing scale sequence: {1,2,5}×10^n and reciprocals, largest first.

scaleCandidates(): number[]

scaleLabel

function

scaleLabel(scale: number): string

SHEET_BUILTIN_PARAMS

const

Default paper size (A3 landscape mm) + scale — the values slice of the ONE lane-builtin table (schema/vocabulary/builtinParams.ts), re-exported here where every sheet consumer already looks. Declaring a matching key in sheet.parameters overrides; scale default expression when seeding is "'auto'".

const SHEET_BUILTIN_PARAMS: BuiltinValues<{ readonly paperWidth: { readonly default: 420

SheetEvaluation

type

What Model.evaluateSheet answers with.

A UNION, not a warnings field beside the sheet, because the failure mode being fixed is a consumer that reads .value.entities and renders a page that LOOKS finished. A field is ignorable by doing nothing; this shape is not reachable at all without naming which case you are in, so "I forgot to check" becomes a compile error rather than a drawing with a view missing.

Measured (parashape sheetSurface fixture): a literal window drew 80 entities with sourceKey stamps [["group1",6],["undefined",74]]; the same window with an undefined variable drew 74, stamps [["undefined",74]]. The 6 stamped entities vanish, placementsOf then skips a placement with no stamped entities, and the placed view is gone from the sheet with a console line as its only trace.

partial still carries the sheet: the drawing that DID compose is worth showing beside "this view could not be placed because: …". What it must not do is arrive looking whole.

type SheetEvaluation
// = {
    status: "complete";
    sheet: Resolved<SheetValue>;
}

sheetFrame

function

The ISO 5457 frame: the BORDER line (binding edge wider) and the rectangle INSIDE the zone band — everything a sheet draws lives in the latter.

sheetFrame(size: { width: number; height: number; }): { border: BoundingBox2d; inner: BoundingBox2d; }

SheetResolveOptions

type

type SheetResolveOptions
// = {
    /** The model's named `views[]` lane — a top-level `viewport` node with
     *  no `at` arg (the auto-tile bucket, see autoTileViewSpecs) resolves
     *  its `source` key against this. */
    views?: View[];
    materials?: Material[];
    /** Forwarded verbatim to each auto-tiled view's own resolveView call —
     *  a `viewDetail` head reads its flat component through it (see
     *  ResolveViewOptions.resolveDetail in views.ts). A POSITIONED
     *  `viewport` (one with `at`) goes the other way round, through
     *  resolveFlatOperations → Model's own view node. */
    resolveDetail?: (source: string) => Entity[];
    /** Resolves the sheet's own `operations` (everything past the extracted
     *  auto-tile view nodes — flat lane, authored in sheet mm, y UP from the
     *  paper's bottom-left, CAD paper-space convention: `viewport`/
     *  `tableEntity`/`imageEntity` place shared content by
     *  key with their own `at`/`scale`) — `Model`'s flat evaluator bound.
     *  `parameters` is the SHEET'S OWN signature, forwarded so the isolated
     *  scope those operations evaluate in can bind it (2026-07-26 — a free
     *  sheet parameter used to be inert). Passed from here rather than closed
     *  over by the caller because `drawingSetToSvg` runs one callback across
     *  every sheet in the set. */
    resolveFlatOperations?: (operations: (Operation | Container)[], parameters?: (Operation | Container)[]) => Entity[];
    /** Evaluates `sheet.title` — an expression like every other authored
     *  string (titleValue law: eval, else the literal). Absent (a bare-engine
     *  caller with no registry) leaves the title literal. */
    evaluateExpression?: (expr: string) => unknown;
    /** ISO 7200 title-block values the ENGINE cannot derive — who owns the
     *  drawing, who checked it, where this sheet sits in the set. Each is a
     *  HOST fact, so it arrives as an option and renders as an empty labelled
     *  cell when the host does not supply it: exactly how a paper title block
     *  behaves before it is signed off.
     *
     *  ONE record, keyed by the standard's own field sources. These used to be
     *  seven loose fields here (`titleAuthor`, `date`, `owner`, `checker`,
     *  `revision`, `sheetOf`, `units`) beside a second spelling in
     *  `TitleBlockInfo` and a third on composeSheet's arg bag, merged by hand
     *  at the one call site that filled the block.
     *
     *  The four cells the engine DOES derive — `title` (the sheet's own
     *  expression), `number` (its key), `scale` (measured or declared) and
     *  `size` (the paper) — are filled by composeSheet and OVERRIDE anything
     *  passed here; `revision` defaults to "-" and `units` to "mm". */
    titleBlock?: TitleBlockInfo;
}

tableEntities

function

One TableValue as sheet-space entities: frame + separators as curves, title/header/cells as text marks. Cells formatted at draw time from ColumnMeta.

tableEntities(table: TableValue & { title?: string; columnWidths?: number[]; }, at: [number, number]): Entity[]

tableHeight

function

Total sheet-mm height a table occupies (title + header + data rows).

tableHeight(table: TableValue & { title?: string; }): number

TitleBlockInfo

type

Values for the standard's title-block fields, keyed by TitleBlockField.source.

type TitleBlockInfo
// = Partial<Record<TitleBlockField["source"], string>>
Last updated: 📖 2 min readEdit on GitHub