Skip to content
Shapemetry

hatchData producers

Every producer whose return is hatchData[] — what it creates is concatenated into the data stream. Authored as a step in an objects[] chain.

MethodDescriptionArgTypeDefaultMeaning
hatchHatch — Build a hatch document: a region, plus the NAME of the patterns[] record whose line families fill it. The pattern is named and never inlined — two hatches drawn with concrete must be the same concrete, one edit must reach both, and every interchange format references a pattern by name (DXF at group code 2, SVG by id from defs). Everything here beside the name says WHERE the pattern sits, which is the half that belongs to this placement.regionobjectnullThe region being filled: a Curve2d document { curves: [...] } of CLOSED rings, with an optional transformation placing their plane in the world. Nested rings punch holes by the even-odd rule — no ring declares itself an island. An open ring throws.
patternstring'Pattern'patterns[] record name (quote literals). A name with no record throws, naming what was declared — a blank region would look like an authoring choice.
angleangle0Rotation of every layer about the hatch origin, in degrees (DXF/.pat convention).
scalenumber1Uniform scale about the origin, multiplying every layer's shift, spacing, dashes and origin. Anisotropy belongs in a layer's own numbers.
originobjectWhere the pattern is anchored, in hatch space, as [x, y]. Absent = [0, 0] of hatch space — NOT the region's own extent: two regions sharing a plane share hatch space, so their hatching lines up across the edge between them.
colorcolorOne colour for every layer, overriding each layer's own. A standard asks for the same pattern in another colour far more often than for a different pattern; duplicating the record to change a colour is how one pattern becomes six.
fillobjectPaint behind every layer, over the whole region: { type: 'solid', color } or { type: 'linearGradient' | 'radialGradient', stops, start, end, repeat? }. Absent = only the lines are drawn.
Last updated: 📖 2 min readEdit on GitHub