docs / Assemble

Assemble

Build a mechanism from parts: connectors, mates, joints, posed Scenes.

A base and a lid joined by one revolute mate, solved at 35 degrees. The mate refers to the two connectors, and the solver puts the lid where the hinge allows. The two colours make it easy to see which part moved.

const arm = assembly('clamshell');

const base = arm.part('base', box(60, 40, 10).color('frame'));
const lid = arm.part('lid', box(60, 40, 6).translate(0, 0, 10).color('tool'));

base.connector('pivot', {
  type: 'axis',
  origin: { kind: 'vec3', value: [0, 20, 10] },
  axis: [1, 0, 0],
});
lid.connector('pivot', {
  type: 'axis',
  origin: { kind: 'vec3', value: [0, 20, 0] },
  axis: [1, 0, 0],
});

arm.mate('hinge', 'base.pivot', 'lid.pivot', 'revolute', { limitsDeg: [0, 120] });

return arm.solvedModel({ hinge: 35 });
JavaScript is off — the listing above is the whole example.

Calls

CallWhat it does
assembly(name?) => AssemblyStart an inspectable mechanical assembly.
joint : { clevis(opts: ClevisJointOptions): ClevisJoint; supportedServoRevolute(arm: Assembly, opts: SupportedServoRevoluteOptions): SupportedServoRevoluteResult; articulatedDigit(arm: Assembly, opts: ArticulatedDigitOptions): ArticulatedDigitResult }Mechanism-delivery joint helpers.
Scene.part(name: string) => ScenePartLook up a part by its assembly-unique name.
Scene.parts : readonly ScenePart[]Frozen, ordered list of parts in the Scene; ordering matches the order parts were added to the Assembly.
Scene.assemblyName : stringName passed to assembly(name?) at capture time; "unnamed-assembly" if no name was provided.