Skip to content

Mounts and attachments

import cadkit as ck
from cadkit import FastenerSpec

These recipes share hardware dimensions between explicitly owned part features. Use the same mount object to create every matching role, then bind those roles with an assembly connection. Matching values on two separate mount objects are not enough.

Mating-datum convention

Mount role frames coincide at the receiver/clamped-part interface. +Z points out of the receiver toward the clamped parts. Receiver pockets extend into negative Z; clamped layers occupy positive Z. This convention is different from standalone Hole and InsertPocket features, whose +Z points into material.

The outermost clearance role defines the screw reference plane. Its Z position is offset + thickness - counterbore.depth for a cylindrical recess, or offset + thickness without a recess. A countersunk screw also references the outer face: its nominal length includes the head. Use head_recess=ck.Countersink(through_diameter, head_diameter) for its 90° conical seat. The cone must leave positive sheet thickness below the recess; the feature records countersinking as a secondary manufacturing operation. Layers passed through via= must continuously cover the grip without gaps or overlaps. Each intermediate instance needs its own placement.

Insert mount

InsertMount dataclass

InsertMount(
    pattern: object,
    screw: FastenerSpec,
    insert: FastenerSpec,
    clearance_diameter: float,
    pocket: InsertPocket,
    minimum_engagement: float,
)

Bases: _Mount

One shared pattern, screw, and insert recipe for matching part features.

Parameters:

Name Type Description Default
pattern object

PointPattern or PolarPattern shared by every role.

required
screw FastenerSpec

Headed screw specification, including its length.

required
insert FastenerSpec

Matching heat-set insert specification with explicit length.

required
clearance_diameter float

Finished screw clearance diameter in millimetres.

required
pocket InsertPocket

Explicit receiving pocket dimensions.

required
minimum_engagement float

Required screw engagement in millimetres.

required

A mount frame is a mating datum: +Z points out of the receiver toward the clamped parts. Insert pockets cut into negative local Z; clearance layers occupy positive Z. Bind roles from the same mount object when connecting.

clearance_side

clearance_side(
    *,
    at=Frame(),
    thickness,
    head_recess=None,
    offset=0,
    slot_length=None,
    slot_angle=0,
    slot_radial=False,
    supplied=False,
    drill_offsets=None
)

Create the outermost clamped role on which the screw head seats.

Parameters:

Name Type Description Default
at Frame

Shared mating datum, +Z toward the clamped layers.

Frame()
thickness float

This layer's thickness in millimetres.

required
head_recess Counterbore | Countersink | None

Optional head recess; countersunk screws require a matching Countersink and use the outer face as their head-inclusive length datum.

None
offset float

Layer start above the mating datum, in millimetres.

0
slot_length float | None

Overall milled-slot length in millimetres.

None
slot_angle float

Slot orientation in local XY degrees.

0
slot_radial bool

Orient each slot along its radius from the pattern origin.

False
supplied bool

Describe already supplied geometry without cutting it.

False
drill_offsets tuple | None

Local XY drill offsets at every fastening site. Mutually exclusive with slot_length; must cover the nominal axis.

None

Returns:

Type Description
MountFeature

Owned clearance role. The reference Z is offset plus thickness, minus depth for a Counterbore only. Countersunk screws reference the outer face because their length includes the head.

middle_side

middle_side(
    *,
    at=Frame(),
    thickness,
    offset=0,
    head_recess=None,
    supplied=False
)

Create an intermediate clamped layer sharing the same mating datum.

Parameters:

Name Type Description Default
at Frame

Datum shared by every role.

Frame()
thickness float

Layer thickness in millimetres.

required
offset float

Layer start above the receiver, in millimetres.

0
head_recess Counterbore | None

Optional recess at this layer's outer face.

None
supplied bool

Describe supplied geometry without modifying it.

False

Returns:

Type Description
MountFeature

Middle role to pass through via= in a connection.

Intermediate and outer layers must cover the grip continuously, without gaps or overlaps. Every intermediate instance must also be placed.

insert_side

insert_side(*, at=Frame(), supplied=False)

Create the receiving insert role owned by a Part or Purchased definition.

Parameters:

Name Type Description Default
at Frame

Mating datum, +Z out of the receiver.

Frame()
supplied bool

Describe existing supplier geometry without cutting it.

False

Returns:

Type Description
MountFeature

Insert-side feature.

describe

describe()

Threaded mount

ThreadedMount dataclass

ThreadedMount(
    pattern: object,
    screw: FastenerSpec,
    clearance_diameter: float,
    pilot_diameter: float | None = None,
    thread_depth: float | None = None,
    hole_depth: float | None = None,
    minimum_engagement: float | None = None,
    method: str = "tap-after-printing",
)

Bases: _Mount

Shared screw connection to a manufactured pilot or an existing supplied thread.

Parameters:

Name Type Description Default
pattern object

PointPattern or PolarPattern of fastening axes.

required
screw FastenerSpec

Screw specification including length.

required
clearance_diameter float

Finished clearance diameter in millimetres.

required
pilot_diameter float | None

Manufactured pilot diameter in millimetres.

None
thread_depth float | None

Available thread depth in millimetres.

None
hole_depth float | None

Pilot or receiving-hole depth in millimetres.

None
minimum_engagement float | None

Required engagement in millimetres, if known.

None
method str

tap-after-printing, tap-after-machining, or self-tapping.

'tap-after-printing'

A generated receiving role requires explicit pilot diameter, thread depth, and hole depth. A supplied=True role can leave unknown supplier values as None; those checks remain unverified. +Z points outward from the receiver.

clearance_side

clearance_side(
    *,
    at=Frame(),
    thickness,
    head_recess=None,
    offset=0,
    slot_length=None,
    slot_angle=0,
    slot_radial=False,
    supplied=False,
    drill_offsets=None
)

Create the outermost clamped role on which the screw head seats.

Parameters:

Name Type Description Default
at Frame

Shared mating datum, +Z toward the clamped layers.

Frame()
thickness float

This layer's thickness in millimetres.

required
head_recess Counterbore | Countersink | None

Optional head recess; countersunk screws require a matching Countersink and use the outer face as their head-inclusive length datum.

None
offset float

Layer start above the mating datum, in millimetres.

0
slot_length float | None

Overall milled-slot length in millimetres.

None
slot_angle float

Slot orientation in local XY degrees.

0
slot_radial bool

Orient each slot along its radius from the pattern origin.

False
supplied bool

Describe already supplied geometry without cutting it.

False
drill_offsets tuple | None

Local XY drill offsets at every fastening site. Mutually exclusive with slot_length; must cover the nominal axis.

None

Returns:

Type Description
MountFeature

Owned clearance role. The reference Z is offset plus thickness, minus depth for a Counterbore only. Countersunk screws reference the outer face because their length includes the head.

middle_side

middle_side(
    *,
    at=Frame(),
    thickness,
    offset=0,
    head_recess=None,
    supplied=False
)

Create an intermediate clamped layer sharing the same mating datum.

Parameters:

Name Type Description Default
at Frame

Datum shared by every role.

Frame()
thickness float

Layer thickness in millimetres.

required
offset float

Layer start above the receiver, in millimetres.

0
head_recess Counterbore | None

Optional recess at this layer's outer face.

None
supplied bool

Describe supplied geometry without modifying it.

False

Returns:

Type Description
MountFeature

Middle role to pass through via= in a connection.

Intermediate and outer layers must cover the grip continuously, without gaps or overlaps. Every intermediate instance must also be placed.

threaded_side

threaded_side(*, at=Frame(), supplied=False)

Create the receiving thread role.

Parameters:

Name Type Description Default
at Frame

Mating datum, +Z out of receiving material.

Frame()
supplied bool

Use an existing supplier thread without cutting a pilot.

False

Returns:

Type Description
MountFeature

Threaded-side feature with any required tapping operation.

describe

describe()

Pocket and recess dimensions

Counterbore dataclass

Counterbore(
    diameter: float,
    depth: float,
    entry_extension: float = 0,
)

Dimensions of a cylindrical head recess used by a hole or mount role.

Parameters:

Name Type Description Default
diameter float

Finished recess diameter in millimetres.

required
depth float

Recess depth below the entry face in millimetres.

required
entry_extension float

Additional cutter extension outside the entry face in millimetres. It does not increase the nominal recess depth.

0

InsertPocket dataclass

InsertPocket(
    diameter: float,
    depth: float,
    insert_outer_diameter: float | None = None,
)

Explicit receiving geometry for a heat-set insert.

Parameters:

Name Type Description Default
diameter float

Finished pocket diameter in millimetres.

required
depth float

Pocket depth in millimetres.

required
insert_outer_diameter float | None

Optional measured insert outer diameter in millimetres, used to bound installed-fit validation.

None

A catalogue thread size does not determine printed pocket fit. Choose dimensions using the supplier's guidance and a process-specific coupon.

feature

feature(*, at=Frame(), pattern=None, insert=None)

Create a standalone owned feature for this pocket.

Parameters:

Name Type Description Default
at Frame

Entry frame, +Z into receiving material, matching Hole.

Frame()
pattern PointPattern | PolarPattern | None

Local XY sites.

None
insert FastenerSpec | None

Heat-set insert specification with explicit length. When provided, metadata includes an installation operation.

None

Returns:

Type Description
InsertPocketFeature

Material-removing feature for a Part definition.

InsertBoss dataclass

InsertBoss(
    pocket: InsertPocket,
    at: Frame = Frame(),
    pattern: object = None,
    insert: FastenerSpec | None = None,
    outer_diameter: float = 0,
    depth: float = 0,
)

Bases: InsertPocketFeature

Add attached cylindrical reinforcement and cut an insert pocket into it.

Parameters:

Name Type Description Default
pocket InsertPocket

Explicit InsertPocket dimensions.

required
at Frame

Boss base and pocket entry frame, +Z into the boss.

Frame()
pattern object

Local XY sites or None.

None
insert FastenerSpec | None

Optional heat-set insert specification with explicit length.

None
outer_diameter float

Boss diameter in millimetres, larger than the pocket.

0
depth float

Boss height in millimetres, at least the pocket depth.

0

Each boss must join the existing body. Pocket entry conventions match InsertPocket.feature(), rather than the mating datum used by InsertMount.

Resulting role

MountFeature dataclass

MountFeature

An owned side of a shared mount, returned by the mount's role factories.

Prefer clearance_side, middle_side, insert_side, or threaded_side instead of constructing this record. apply performs its explicit cuts; supplied=True preserves the body. describe includes the mounting recipe, frame, layer dimensions, and postprocessing operations.

seat property

seat

Return the clamped role screw-seat Z coordinate in millimetres; receivers have no seat.

apply

apply

describe

describe

Hardware attachments without placement

Use assembly.attach() for individually named features within an already placed part or set of parts. These recipes derive hardware positions from the features. They do not invent receiving geometry or a placement relationship.

CaptiveNutFastening dataclass

CaptiveNutFastening(
    screw: FastenerSpec,
    nut: FastenerSpec,
    nut_thickness: float,
)

Bind a headed screw through a Hole to an opposing NutPocket.

Parameters:

Name Type Description Default
screw FastenerSpec

Headed screw specification with explicit length.

required
nut FastenerSpec

Hex-nut specification with the same thread size.

required
nut_thickness float

Explicit nut thickness in millimetres.

required

Use assembly.attach(name, recipe, through=..., nut=...). Features must be individually named, coaxial, and have opposing entry directions; patterns are not supported. The pocket must fit the declared nut thickness. This adds hardware and bounded thread intent without changing placement.

describe

describe()

SetScrew dataclass

SetScrew(
    screw: FastenerSpec,
    minimum_engagement: float | None = None,
)

Bind a radial set screw to a TappedHole and the flat of a DBore.

Parameters:

Name Type Description Default
screw FastenerSpec

FastenerSpec with kind="set_screw" and explicit length.

required
minimum_engagement float | None

Required engagement in millimetres, if known.

None

Use assembly.attach(name, recipe, thread=..., stop=...). The individually named pilot points toward the D-flat and determines the screw axis. The tip is placed on the finite flat plane. Actual retention and shaft fit remain unverified; patterns are not supported.

describe

describe()