Skip to main content

insert()

Place a part or sub-assembly definition in the current assembly.

const left = insert(bracket); // the literals
const wide = insert(frame, 'Wide'); // a configurations() row
const deep = insert(frame, 'Wide', { Depth: 1000 }); // the row, with one value changed
const long = insert(bracket, { Length: 380 }); // values only

A string second argument names a row of the definition's configurations() table; the override object then moves to the third position and layers on top of the row. A name the table does not declare is an error on this statement, listing the declared names. 'Default' is the literals — the same as no name.

Units: a part built from a file with a different unit() than the project is rescaled into the assembly's unit at render time — an inch part inserted into an mm project renders 25.4× larger, connectors and all, with the instance pose untouched. Parameter overrides and configuration cells are NOT converted: insert(def, { width: 10 }) reads 10 in the PART's unit (10 in for an inch part), whatever the assembly runs in — the values feed the part's own param() calls, whose numbers are the part file's numbers.

Returns: Instance | Occurrence

tip

See the guide for detailed usage examples.

Signatures​

insert(definition: PartDefinition<T>, overrides?: ParamOverrides): Instance<T>

Place a part or sub-assembly definition in the current assembly.

const left = insert(bracket); // the literals
const wide = insert(frame, 'Wide'); // a configurations() row
const deep = insert(frame, 'Wide', { Depth: 1000 }); // the row, with one value changed
const long = insert(bracket, { Length: 380 }); // values only

A string second argument names a row of the definition's configurations() table; the override object then moves to the third position and layers on top of the row. A name the table does not declare is an error on this statement, listing the declared names. 'Default' is the literals — the same as no name.

Units: a part built from a file with a different unit() than the project is rescaled into the assembly's unit at render time — an inch part inserted into an mm project renders 25.4× larger, connectors and all, with the instance pose untouched. Parameter overrides and configuration cells are NOT converted: insert(def, { width: 10 }) reads 10 in the PART's unit (10 in for an inch part), whatever the assembly runs in — the values feed the part's own param() calls, whose numbers are the part file's numbers.

ParameterTypeDescription
definitionPartDefinition<T>A part() or assembly() definition.
overridesParamOverrides{ label: value } for the definition's param() calls. (optional)

insert(definition: PartDefinition<T>, configuration: string, overrides?: ParamOverrides): Instance<T>
ParameterTypeDescription
definitionPartDefinition<T>
configurationstring
overridesParamOverrides(optional)

insert(definition: Assembly<T>, overrides?: ParamOverrides): Occurrence<T>
ParameterTypeDescription
definitionAssembly<T>
overridesParamOverrides(optional)

insert(definition: Assembly<T>, configuration: string, overrides?: ParamOverrides): Occurrence<T>
ParameterTypeDescription
definitionAssembly<T>
configurationstring
overridesParamOverrides(optional)

insert(part: P, overrides?: ParamOverrides): Instance<P>
ParameterTypeDescription
partP
overridesParamOverrides(optional)