Skip to main content
Built-in Elements

<assembly.subassembly />

assembly.subassembly groups mechanical parts in one local frame. It can have its own CAD model, children, or both. A group with no geometry can still define mounting faces and move all its children together. assembly.cadassembly is an alias with the same props.

Mount a group with relative offsets​

The base's mount face is at Z = 6 mm. MODULE mates its base to that face, moves 6 mm along the face's X tangent and −4 mm along its Y tangent, and leaves a 2 mm inspection gap. The blue housing and steel bearing inherit the group frame.

import { assembly } from "tscircuit"
import { BearingHousing, SlottedBase, bearingModel } from "./models"

export default () => (
<assembly.device>
<assembly.printedpart name="BASE" jscad={<SlottedBase />}>
<assembly.referencesurface name="mount" centerZOffset={6} />
</assembly.printedpart>
<assembly.subassembly name="MODULE"
mountedTo=".BASE > .mount" mountFace="base"
mountOffset={{ x: "6mm", y: "-4mm" }} mountGap="2mm">
<assembly.referencesurface name="base" normalDirection="z-" />
<assembly.printedpart name="HOUSING" jscad={<BearingHousing />}>
<assembly.referencesurface name="bearingSeat" centerZOffset={4} />
<assembly.referencesurface name="boltSeat"
centerXOffset={22} centerYOffset={12} centerZOffset={6} />
</assembly.printedpart>
<assembly.part name="BEARING"
cadModel={bearingModel}
mountedTo=".HOUSING > .bearingSeat" mountFace="base">
<assembly.referencesurface name="base" normalDirection="z-" />
</assembly.part>
</assembly.subassembly>
</assembly.device>
)

MODULE has no model of its own. Its origin resolves to [6, -4, 8] mm. The bearing's bottom is another 4 mm above that origin, at its housing's pocket floor. Change the outer mount to reposition the complete module; the child parts' internal face constraints stay the same.

Offsets use the target face's local axes. Rotating a target frame changes the directions followed by mountOffset.x/y; mountGap always follows its outward normal. See assembly.referencesurface for XY, XZ and YZ frame directions.

Subassembly properties​

PropertyDescription
nameRequired group name.
displayNameOptional display label.
purchaseUrlsOptional purchase links.
supplierPartNumbersOptional supplier part numbers, e.g. { jlcpcb: ["C123"] }.
modelModelprinter string or HTTP(S) model URL.
modelUrlImported CAD model URL.
cadModelModel with advanced alignment options; see cadmodel.
mountedToTarget reference face selector, such as .BASE > .mount. Compact paths such as BASE.mount also work.
mountFaceNamed reference face on this group; supply with mountedTo.
mountOffsetOptional signed target-local { x?, y? } distances. Omitted axes are zero. Requires mountedTo.
mountGapOptional nonnegative normal clearance, default zero. Requires mountedTo.
childrenReference surfaces, nested assembly elements, or CAD models.

Choose at most one of model, modelUrl, or cadModel. Omit all three for a group with no model. Reference surfaces can be children of either kind of group.

Group placement and model alignment​

A mount determines the group's full rigid frame, including tilt, and its children inherit that frame. Unmounted groups inherit their containing assembly's placement; a standalone unmounted group starts at the world origin. References resolve within the nearest assembly.device; qualify selectors when several groups contain parts with the same name.

cadModel.positionOffset and rotationOffset affect only the group's own mesh. Use them to align an imported asset's origin to its authored reference surfaces. Use a face mount to position the group and its children together.

For fasteners that follow actual PCB holes or mechanical hole datums, use assembly.bolt. For a connector-relative display, use assembly.screen.