Mechanical contracts and validation
These mechanical records describe installed geometry. They do not move parts or cut holes. Assemblies can generate these records from their local connection graph.
Component references may be an unambiguous leaf name or a full URL-encoded
assembly path. Duplicate leaf names require full paths. Discover live app IDs
from get_state; don't reconstruct them from a screenshot or reuse stale IDs.
Joint
dataclass
Joint(
name: str,
components: tuple[str, ...],
kind: str = "rigid",
origin: tuple[float, float, float] = (0, 0, 0),
axis: tuple[float, float, float] = (0, 0, 1),
limits: tuple[float, float] | None = None,
position: float = 0,
interfaces: tuple[str, ...] = (),
fastenings: tuple[str, ...] = (),
description: str = "",
parent_components: tuple[str, ...] = (),
child_components: tuple[str, ...] = (),
)
A declared relationship between already installed components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique joint name. |
required |
components
|
tuple[str, ...]
|
At least two distinct component names or full assembly paths. |
required |
kind
|
str
|
|
'rigid'
|
origin
|
tuple[float, float, float]
|
Installed joint origin in world millimetres. |
(0, 0, 0)
|
axis
|
tuple[float, float, float]
|
Installed motion axis, normalized on construction. |
(0, 0, 1)
|
limits
|
tuple[float, float] | None
|
Optional inclusive coordinate limits, in degrees for revolute motion or millimetres for sliders. |
None
|
position
|
float
|
Declared installed coordinate in the corresponding units. |
0
|
interfaces
|
tuple[str, ...]
|
Related Interface names. |
()
|
fastenings
|
tuple[str, ...]
|
Related Fastening names. |
()
|
description
|
str
|
Human-readable intent. |
''
|
parent_components
|
tuple[str, ...]
|
Components on the parent datum side. |
()
|
child_components
|
tuple[str, ...]
|
Components on the child datum side, including nested leaves. |
()
|
Stable Joint metadata does not move geometry. For pose-driven placement, use declarative Assembly connections.
Interface
dataclass
Interface(
name: str,
components: tuple[str, str],
kind: str = "contact",
region: Callable[[], Shape] | None = None,
max_overlap_mm3: float = 0,
min_clearance_mm: float = 0,
max_gap_mm: float | None = None,
description: str = "",
)
A bounded contact or clearance contract between two installed components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique interface name. |
required |
components
|
tuple[str, str]
|
Exactly two component names or full paths. |
required |
kind
|
str
|
|
'contact'
|
region
|
Callable[[], Shape] | None
|
Lazy native solid in world millimetres delimiting allowed overlap.
Required whenever |
None
|
max_overlap_mm3
|
float
|
Maximum permitted native intersection volume inside the region. It cannot be positive for a clearance interface. |
0
|
min_clearance_mm
|
float
|
Minimum required separation in millimetres. |
0
|
max_gap_mm
|
float | None
|
Maximum allowed distance in millimetres. Contact interfaces
replace |
None
|
description
|
str
|
Explanation of the intended fit or contact. |
''
|
Values must be nonnegative when supplied. Permitting overlap does not excuse collisions outside the specified region.
Fastening
dataclass
Fastening(
name: str,
components: tuple[str, ...],
sites: tuple[FastenerSite, ...] = (),
hardware: tuple[HardwareItem, ...] = (),
joint: str | None = None,
kind: str = "through",
grip_mm: float | None = None,
thread_depth_mm: float | None = None,
min_engagement_mm: float | None = None,
hole_depth_mm: float | None = None,
min_tip_clearance_mm: float = 0.2,
access: tuple[AccessEnvelope, ...] = (),
insertion_distance_mm: float = 20,
description: str = "",
quantity: int | None = None,
thread_size: str | None = None,
)
Repeated located hardware and explicit grip/engagement requirements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique fastening name. |
required |
components
|
tuple[str, ...]
|
One or more distinct participating component references. |
required |
sites
|
tuple[FastenerSite, ...]
|
Installed axes where the entire hardware stack is repeated. |
()
|
hardware
|
tuple[HardwareItem, ...]
|
Named HardwareItems, each with an axial offset. |
()
|
joint
|
str | None
|
Associated Joint name, if this fastening secures a joint. |
None
|
kind
|
str
|
|
'through'
|
grip_mm
|
float | None
|
Clamped stack thickness along the screw axis. |
None
|
thread_depth_mm
|
float | None
|
Available thread engagement depth. |
None
|
min_engagement_mm
|
float | None
|
Minimum required screw engagement. |
None
|
hole_depth_mm
|
float | None
|
Total receiving depth for blind-hole tip-clearance checks. |
None
|
min_tip_clearance_mm
|
float
|
Required free depth beyond the screw tip. |
0.2
|
access
|
tuple[AccessEnvelope, ...]
|
Explicit swept tool/access checks. |
()
|
insertion_distance_mm
|
float
|
Outward distance for the presentation preview. |
20
|
description
|
str
|
Human-readable assembly intent. |
''
|
quantity
|
int | None
|
Positive BOM count for unlocated hardware, or a count matching the number of sites when sites are present. |
None
|
thread_size
|
str | None
|
Explicit receiving thread designation, when known. |
None
|
Unknown dimensions remain None and related checks remain unverified.
A BOM quantity without sites does not establish hardware placement.
AccessEnvelope
dataclass
AccessEnvelope(
name: str,
envelope: Callable[[], Shape] | None = None,
obstacles: tuple[str, ...] = (),
description: str = "",
)
A complete swept tool or insertion solid checked against explicit obstacles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique access name within a fastening. |
required |
envelope
|
Callable[[], Shape] | None
|
Lazy native solid in installed world millimetres, including the whole swept tool body, not only a centre line. |
None
|
obstacles
|
tuple[str, ...]
|
Explicit component references to test against the envelope. |
()
|
description
|
str
|
The intended tool, direction, and assembly operation. |
''
|
An omitted envelope records unverified access. A supplied envelope proves only this geometry against this obstacle set in the installed pose.
Validation
validate_mechanics
Validate installed collisions and the project's declared mechanical contracts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
Project containing declarations. |
required |
assembly
|
Assembly | None
|
Reuse installed geometry, or build the project's default assembly. |
None
|
scan_collisions
|
bool
|
Scan undeclared native component intersections. Disabling this leaves collision coverage unverified. |
True
|
tolerance_mm3
|
float
|
Volume tolerance for native overlap checks. |
1e-05
|
Returns:
| Type | Description |
|---|---|
dict
|
Schema-versioned report with overall |
Mesh-dependent checks, unknown supplier dimensions, unspecified tool access, and unmodelled motion sweeps are reported as unverified where relevant.
The corresponding Project method is the convenient entry point:
| Overall status | Meaning |
|---|---|
pass |
The declared checks and recorded coverage passed |
fail |
At least one confirmed failure exists |
incomplete |
No confirmed failure, but some checks or coverage are unverified |
Unknown values remain unknown. Contact at one pose, simplified supplier geometry, and a clear tool envelope do not establish loaded strength, manufacturing tolerances, or a complete assembly sequence.
See preflight for how reports gate manufacturing exports, and file contracts for report fields.
Hardware bill of materials
hardware_bom
Aggregate hardware quantities by FastenerSpec identity without building shapes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fastenings
|
tuple[Fastening, ...]
|
Located or quantity-only hardware declarations. |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
Specification, quantity, associated fastening IDs, and whether all contributions are located. |