Use this document when adding or fixing an IGES entity decoder. It is written for human developers and AI assistants.
For entity type NNN:
packages/iges-core/src/entities/decoders/typeNNN.ts — decode RawEntity → geometry typepackages/iges-core/src/entities/registry.ts — register decoder, add to GEOMETRY_ENTITY_TYPES if drawablepackages/iges-core/src/types.ts — add XxxGeometry interface if new shapesrc/three/toThree.ts — tessellate to Three.js (if drawable)test/fixtures/<name>.iges — minimal fixturepackages/iges-core/test/*.test.ts — assertions on parseAndResolveIGESimport type { DecodeContext } from "../decodeContext.js";
import type { SomeGeometry } from "../../types.js";
/** Entity type NNN — <name from IGES spec> */
export function decodeTypeNNN(ctx: DecodeContext): SomeGeometry | null {
const { entity, transform, warnings } = ctx;
const p = entity.params; // ParamValue[]
// Use paramNumber(p, index), paramInt(p, index)
// Return null + warnings.push(...) if unsupported form
}
three in iges-core.resolveReferences() applies world transforms.paramNumber uses 0-based indices (first PD field after entity type = index 0).IGES spec tables list parameters starting at index 1 (entity type is separate).
| Spec index | Name | paramNumber(p, ?) |
|---|---|---|
| 1 | First parameter | 0 |
| 2 | Second | 1 |
| n | … | n - 1 |
| PD index | Field | Type |
|---|---|---|
| 1–3 | X, Y, Z | Real |
| PD index | Field |
|---|---|
| 1–3 | Start X,Y,Z |
| 4–6 | End X,Y,Z |
| PD index | Field |
|---|---|
| 1 | ZT |
| 2–3 | Center X,Y |
| 4–5 | Start X,Y |
| 6–7 | End X,Y |
Radius = distance(center, start) in XY.
Use form number from DE and IP (first PD integer):
| Form / IP | Meaning |
|---|---|
| 12 / IP=2 | (x,y,z) triples |
| 40 | Witness line, common Z |
| 63 | Closed planar polyline |
See decodeType126.ts for knot/weight/control point layout (K, M, flags, knots, weights, CPs, t0, t1).
Evaluation: math/nurbs.ts → sampleNurbsCurve().
| Type | Role |
|---|---|
| 124 | Transform — parsed in resolve/parseTransform124.ts |
| 314 | Color palette |
| 402 | Associativity (visibility, groups) |
| 406 | Property |