Fasteners
Fastener geometry comes from the pinned cq_warehouse catalogue or an explicit
supplier factory. A specification describes a purchased item; a HardwareItem
is a named role in a stack; a FastenerSite places that stack.
Supported catalogue kinds
kind |
Default standard |
Length convention |
|---|---|---|
socket_head_cap_screw |
iso4762 |
Under-head shaft length |
set_screw |
iso4026 |
Drive-end to tip |
hex_head_screw |
iso4017 |
Under-head shaft length |
button_head_screw |
iso7380_1 |
Under-head shaft length |
countersunk_screw |
iso10642 |
Flush head top to tip, including head |
hex_nut |
iso4032 |
Normally omitted |
plain_washer |
iso7089 |
Normally omitted |
heat_set_insert |
McMaster-Carr |
Explicit length for engagement contracts |
Countersunk screws use their flush top plane as the insertion origin. For a
mount, use head_recess=ck.Countersink(clearance_diameter, head_diameter) on the
clearance role. Its 90° conical seat leaves positive material below the recess;
the grip is measured from the plate's outer face. Engagement checks account for
the catalogue's actual threaded length. A laser-cut plate requires a secondary
countersinking operation, recorded in its feature metadata.
Thread strings are provider keys, such as M3-0.5; vendor inserts may use
provider-specific size strings. Dimensions and simple hardware geometry are
loaded lazily. Catalogue support depends on the pinned provider's tables.
FastenerSpec
dataclass
FastenerSpec(
kind: str,
size: str,
standard: str = "",
length_mm: float | None = None,
manufacturer: str = "",
part_number: str = "",
description: str = "",
representation: str = "catalogue",
factory: (
Callable[["FastenerSpec"], Shape] | None
) = None,
)
An immutable catalogue or supplier specification for simplified hardware.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
Supported fastener kind; see the catalogue table in the reference. |
required |
size
|
str
|
Provider thread/size designation, such as |
required |
standard
|
str
|
Provider catalogue type; an empty string selects the kind's default. |
''
|
length_mm
|
float | None
|
Positive screw length; also explicitly supplied for insert engagement contracts. Nuts and washers normally omit it. |
None
|
manufacturer
|
str
|
Supplier identity for BOM aggregation. |
''
|
part_number
|
str
|
Supplier identifier for BOM aggregation. |
''
|
description
|
str
|
Human-readable notes; these do not change the stable spec ID. |
''
|
representation
|
str
|
|
'catalogue'
|
factory
|
Callable[['FastenerSpec'], Shape] | None
|
Optional callable receiving this specification and returning a valid native Shape. Custom dimensions may be unavailable. |
None
|
Building never cuts host parts. Hardware has simplified geometry, not helical threads. Countersunk screws use their top plane as the insertion origin and their catalogue length includes the head.
id
property
Return a deterministic hardware identity derived from specification fields, excluding notes.
clearance_diameter
Read a clearance-hole diameter from the provider catalogue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit
|
str
|
Catalogue fit key, normally |
'Normal'
|
Returns:
| Type | Description |
|---|---|
float
|
Nominal clearance diameter in millimetres. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The requested key is absent from the provider's table. |
clearance_cutter
Build an explicit cylinder along positive local Z.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depth_mm
|
float
|
Positive cutting depth in millimetres. |
required |
fit
|
str
|
Provider clearance fit key. |
'Normal'
|
allowance_mm
|
float
|
Caller-chosen diametral allowance added to the catalogue diameter; the resulting diameter must stay positive. |
0
|
Returns:
| Type | Description |
|---|---|
Shape
|
Native cutter with its bottom at the local origin. |
build
Build native hardware in CadKit's insertion coordinates.
Returns:
| Type | Description |
|---|---|
Shape
|
Screw shaft along +Z and head along -Z, with its under-head seat at Z=0. A countersunk screw starts at its flush top plane, with the head and shaft inside its nominal length along +Z. A set screw starts at its drive-end plane; nuts and washers start at Z=0. No installed placement is applied. |
HardwareItem
dataclass
HardwareItem(
name: str, spec: FastenerSpec, offset_mm: float = 0
)
One named item in the hardware stack repeated at each FastenerSite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique role within the fastening, such as |
required |
spec
|
FastenerSpec
|
Reusable hardware specification. |
required |
offset_mm
|
float
|
Translation along the site's insertion axis in millimetres. |
0
|
FastenerSite
dataclass
FastenerSite(
name: str,
origin: tuple[float, float, float] = (0, 0, 0),
axis: tuple[float, float, float] = (0, 0, 1),
x_axis: tuple[float, float, float] | None = None,
)
An installed fastening axis and optional rotational clocking datum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique site name within the fastening. |
required |
origin
|
tuple[float, float, float]
|
Hardware reference seat in world millimetres. |
(0, 0, 0)
|
axis
|
tuple[float, float, float]
|
Insertion direction; normalized on construction. |
(0, 0, 1)
|
x_axis
|
tuple[float, float, float] | None
|
Optional local X direction perpendicular to the insertion axis, for deterministic clocking of hexagons or other nonround hardware. |
None
|
place
Transform local hardware or a cutter into installed coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Shape
|
Shape authored along local +Z. |
required |
offset_mm
|
float
|
Additional translation along the insertion axis. |
0
|
Returns:
| Type | Description |
|---|---|
Shape
|
Located native geometry. |
For quantities, engagement checks, and named relationships, see Fastening and mechanical validation.