Skip to main content

assembly()

Declares a sub-assembly: a named body of insert() / mate() statements that can itself be inserted into another assembly. Returns a LAZY definition — nothing runs until insert(def) executes the callback under a fresh occurrence scope (or the entry render runs an exported one):

export const gantry = (width = 700) => assembly('gantry', () => {
const beam = insert(beamPart).grounded(); // anchor of THIS frame
...
return { beam }; // exposed as occurrence.parts
});

// parent file
const g = insert(gantry(700)).translate(0, 50).grounded();
mate('fastened', g.parts.beam.connectors.mount, base.connectors.top);

.grounded() inside the body means "fixed in this assembly's frame" — standalone editing grounds it for real, while a parent only grounds it by grounding the occurrence. Parameterize with param() inside the body: insert(def, { Width: 900 }) resolves them per occurrence, and the defining file's entry render shows them in the params panel.

Returns: Assembly

tip

See the guide for detailed usage examples.

Signatures

assembly(name: string, callback: () => T): Assembly<T>

Declares a sub-assembly: a named body of insert() / mate() statements that can itself be inserted into another assembly. Returns a LAZY definition — nothing runs until insert(def) executes the callback under a fresh occurrence scope (or the entry render runs an exported one):

export const gantry = (width = 700) => assembly('gantry', () => {
const beam = insert(beamPart).grounded(); // anchor of THIS frame
...
return { beam }; // exposed as occurrence.parts
});

// parent file
const g = insert(gantry(700)).translate(0, 50).grounded();
mate('fastened', g.parts.beam.connectors.mount, base.connectors.top);

.grounded() inside the body means "fixed in this assembly's frame" — standalone editing grounds it for real, while a parent only grounds it by grounding the occurrence. Parameterize with param() inside the body: insert(def, { Width: 900 }) resolves them per occurrence, and the defining file's entry render shows them in the params panel.

ParameterTypeDescription
namestringThe assembly's display name.
callback() => TThe body; its return value is exposed per-occurrence as occurrence.parts.