@huukhanhnguyen/types / objects/curve
objects/curve
CurveData
CurveData = {
edges:CurveEdge[]; }
Object-tier curve datablock — N chains, each with its own claims.
Distinct from the kernel Curve document (geometry/curve.ts), which may carry transformation for geometry ops; object placement lives on instances, so CurveData does not have that field.
Array-of-structs, matching Blender's curve datablock: a Blender Curve holds a ListBase of Nurb splines and each spline carries its own mat_nr / resolu / flags directly (DNA_curve_types.h), rather than parallel per-spline arrays hanging off the datablock.
edges
edges:
CurveEdge[]
CurveEdge
CurveEdge = {
attributes?:Record<string,unknown> |null;color?:string;curve:PolyCurve;layer?:string;lineWidth?:number;material?:string; }
One authored chain in a curve document, carrying its own claims.
A CurveEdge is a lone unshared chain — no vertices, no loops, no sharing with a neighbour. The {Kind}{ElementKind} prefix is what lets "edge" mean that here and a shared topology edge on BrepData without collision (ARCHITECTURE.md Entity). Blender's matching type is Nurb/Spline in a Curve datablock; that spelling is not the type name here.
attributes?
optionalattributes?:Record<string,unknown> |null
Opaque claims for this chain — absent or null = no claims. Written by object assembly or curve* ops, never hand-authored.
color?
optionalcolor?:string
Stroke colour for THIS chain, as a CSS colour string, overriding the placement's material. Absent === inherit.
Colour, width and dash are what a line HAS — the drafting trio every linework format states its own way (SVG stroke / stroke-width / stroke-dasharray, DXF layer colour / lineweight / linetype) — so they sit on the chain rather than in attributes.
curve
curve:
PolyCurve
layer?
optionallayer?:string
Layer key for THIS chain, overriding its placement's Instance.layer. Absent === inherit from the instance.
Per-chain for the reason material already is, and a curve document is the case that forces it: DXF assigns layer per ENTITY and never per block, so one imported drawing legitimately carries N layers across its chains before it is ever wrapped into one Object.
lineWidth?
optionallineWidth?:number
Stroke width in millimetres, world units and not pixels. Absent === the renderer's hairline.
material?
optionalmaterial?:string
Material key for THIS chain, overriding its placement's Instance.material. Absent === inherit from the instance.
Per-chain for the same reason layer is: one document holds many chains — curveFromFace gives each ring the material of the face it came off — so the claim cannot ride the placement.
CurveInstance
CurveInstance =
BaseInstance& {material?:string; }
CurveObject
CurveObject =
BaseObject& {data:CurveData;instances:CurveInstance[];type:"curve"; }
An object whose data is one curve document — N PolyCurve chains.