Skip to content
Shapemetry

Model - Annotation

API reference for src/nodeMethods/annotation on @huukhanhnguyen/model, reachable from ./compute.

See the Guide for the ModelJSON / evaluate pipeline.

API reference

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

BUILTIN_ANNOTATION_STYLE

const

const BUILTIN_ANNOTATION_STYLE: AnnotationStyle

BUILTIN_TEXT_STYLE

const

Drafting-mark producers, and the DRAWN FORM every measured mark carries.

Each mark is two things at once: the MEASUREMENT (its geometry — points and an arc, never a stored value) and the DRAWING of it (extension lines, a dimension line, arrowheads, a text). The drawing is built HERE, at evaluate time, and rides on the entity as entities — so an exporter walks real linework instead of re-deriving arrow geometry from a kind string, and the source string survives (nothing is baked to glyph outlines; engraved lettering that is real geometry is textCurve, a different feature).

The drawing math ported from crates/io/src/svg.rs's render_annotation (deleted in the same change), with one difference that matters: that ran in 2D AFTER projection, so it could assume a screen plane. Here it runs in MODEL space, so every mark derives its own drawing plane from its own geometry.

const BUILTIN_TEXT_STYLE: TextStyle

centerMark

function

The cross at a circle's centre. NOT a dimension: it measures nothing, which is why it is plain linework sized by the style's centerMarkSize (DXF's own DIMCEN) rather than a fourth dimension type — that mistake is what forced value/text optional on every dimension until 2026-08-16.

centerMark(center: Point, style?: string, styles?: ResolvedAnnotationStyles): Entity[]

dimensionAngular

function

dimensionAngular(vertex: Point, point1: Point, point2: Point, arcPoint: Point, style?: string, text?: string, styles?: ResolvedAnnotationStyles): Entity[]

dimensionLinear

function

dimensionLinear(point1: Point, point2: Point, linePoint: Point, style?: string, text?: string, styles?: ResolvedAnnotationStyles): Entity[]

dimensionRadial

function

dimensionRadial(curve: Entity[] | Entity, angle?: number, style?: string, text?: string, styles?: ResolvedAnnotationStyles): Entity[]

drawAngularDimension

function

drawAngularDimension(geometry: AngularDimension, styles: ResolvedAnnotationStyles, override?: { text?: string; textPoint?: Point; }): Entity[]

drawLeader

function

drawLeader(geometry: { targets: Point[]; landing: Point; }, styles: ResolvedAnnotationStyles, text: string): Entity[]

drawLinearDimension

function

The drawn form of a linear dimension.

The dimension LINE is the line through linePoint along the measuring direction; each reference drops a perpendicular onto it. That is why linePoint replaced a signed offset number: the offset's sign only ever meant "which side", which a point states without a convention to remember.

drawLinearDimension(geometry: LinearDimension, styles: ResolvedAnnotationStyles, override?: { text?: string; textPoint?: Point; }): Entity[]

drawRadialDimension

function

drawRadialDimension(geometry: RadialDimension, styles: ResolvedAnnotationStyles, override?: { text?: string; textPoint?: Point; }): Entity[]

imageEntity

function

imageEntity(url: string, at?: Point, width?: number, height?: number): Entity[]

leader

function

leader(target: Point, landing: Point, text: string, style?: string, styles?: ResolvedAnnotationStyles): Entity[]

resolveStyles

function

Resolve a style NAME against the document's lanes, falling back to the builtin of the same name. Throws on a name that is neither — a mark drawn with a style nobody declared is a broken drawing, not a default one.

resolveStyles(name: string, annotationStyles: AnnotationStyle[] | undefined, textStyles: TextStyle[] | undefined): ResolvedAnnotationStyles

resolveStylesForMethod

function

What the wiring hands a producer. text and centerMark name only ONE of the two lanes, so the other side falls back to its builtin rather than demanding a record the author never had to write.

resolveStylesForMethod(method: string, name: string, annotationStyles: AnnotationStyle[] | undefined, textStyles: TextStyle[] | undefined): ResolvedAnnotationStyles

resolveTextStyle

function

resolveTextStyle(name: string, textStyles: TextStyle[] | undefined): TextStyle

textEntity

function

Text in the XY plane — the authored case. A mark on another plane is produced by transforming this one, which maps normal/xAxis with it.

textEntity(position: Point, content: string, width?: number, style?: string, styles?: ResolvedAnnotationStyles): Entity[]
Last updated: 📖 2 min readEdit on GitHub