Skip to content
Shapemetry

@huukhanhnguyen/model / nodeMethods/hatch

nodeMethods/hatch

asPoint2d()

asPoint2d(value, label): Point2d

Parameters

value

unknown

label

string

Returns

Point2d


describe()

describe(value): string

Parameters

value

unknown

Returns

string


expandHatch()

expandHatch(hatch, pattern, sheetScale?, chordTolerance?): HatchMarks

Expand one hatch to the marks that draw it, with the patterns[] record it names already resolved. Layers are expanded in order, so the marks come back in paint order too.

sheetScale is model millimetres per sheet millimetre — required exactly when the pattern measures in paper space, ignored otherwise.

The region's own fill is NOT expanded here: a filled area is paint over a region, not a mark, and nothing is gained by turning it into geometry.

Parameters

hatch

HatchEntity

pattern

Pattern

sheetScale?

number

chordTolerance?

number

Sampling sag for the region's rings, in millimetres. Absent = adaptive (see chordToleranceFor). A caller drawing a magnified detail passes a tighter one.

Returns

HatchMarks


expandHatches()

expandHatches(hatches, patterns, sheetScale?): HatchMarks

Expand every hatch of a document, in document order, each resolving its own patterns[] record by name.

Parameters

hatches

HatchEntity[]

patterns

Pattern[] | undefined

sheetScale?

number

Returns

HatchMarks


finiteNumber()

finiteNumber(value, label): number

Parameters

value

unknown

label

string

Returns

number


hatch()

hatch(region, pattern, angle?, scale?, origin?, color?, fill?): HatchData

Parameters

region

unknown

pattern

unknown

angle?

unknown

scale?

unknown

origin?

unknown

color?

unknown

fill?

unknown

Returns

HatchData


resolvePattern()

resolvePattern(name, patterns): Pattern

The patterns[] record a hatch names. A name with no record THROWS: the pattern is the whole of what draws the hatch, so drawing nothing instead would be a blank region that looks like an authoring choice.

Parameters

name

string

patterns

Pattern[] | undefined

Returns

Pattern


toWorld()

toWorld(point, placement): Point

Place a 2D hatch-space point back in the world.

COLUMN-major, because that is what a Transformation IS in this repo: translation([10, 20, 30]) answers […, 10, 20, 30, 1], putting the offset at 12/13/14, and transformData composes exactly such a matrix onto a region's placement. Reading it row-major instead is not a rounding error — measured 2026-08-22, moving a hatch 100mm moved its marks by 0.

(BrepFace.uvMatrix is the other convention and is documented row-major at its own declaration; it is a different field, read by matrixToFrame. Do not carry that layout over here.)

Parameters

point

Point2d

placement

Transformation | undefined

Returns

Point

Last updated: 📖 3 min readEdit on GitHub