Skip to content
Shapemetry

@huukhanhnguyen/types / evaluate/pattern

evaluate/pattern

Pattern

Pattern = { lengthSpace?: "model" | "paper"; lines: HatchLineEntity[]; name: string; }

Resolved pattern record — the drawing side of appearance, as Material is the surface side and Layer the classification side.

Produced by evaluatePatterns() in the model package from the authored pattern-method nodes; a resolved record is never written back to the document.

A pattern is the line families and NOTHING about where they are drawn. That split is what makes the record shareable at all: anything region-dependent would be a different pattern per region, leaving nothing to name. It is also what every interchange format requires — DXF names a pattern at group code 2, SVG references one by id from defs, PDF as a named resource — so a pattern that cannot be named cannot be written out at all.

lengthSpace?

optional lengthSpace?: "model" | "paper"

Which space this pattern's lengths are measured in. Absent === "model".

"model" — spacing, shift, dashes and lineWidth are millimetres of the MODEL, so the pattern shrinks with the drawing as the view scale falls. A material's own texture-like pattern wants this.

"paper" — the same numbers are millimetres of the SHEET, so a 2mm spacing prints as 2mm whether the view is at 1 or 1. Every drafting standard specifies its hatches this way, and getting it wrong is not a small error: at 1 a model-space 2mm hatch prints at 0.02mm and reads as solid black.

Precedent for the choice being a property of the PATTERN rather than of each hatch: Archicad carries it on the fill attribute (its help calls the two "scale with plan" and "scale independent"); AutoCAD reaches the same end through annotative scaling.

TODAY, "paper" is authorable and expandable but has no in-repo caller: renderLeaf takes a sheetScale and both of its callers fold MODEL space, where no sheet exists. Expanding a paper pattern without one THROWS, on purpose. A host that places a view on a sheet is the party that knows the number.

lines

lines: HatchLineEntity[]

The drawn layers, painted in order. EMPTY is legitimate: a pattern that draws nothing is how a region gets a solid fill and no linework over it.

name

name: string

Last updated: 📖 2 min readEdit on GitHub