Assembly families
Three mechanism families extend the rotating pin: a hinged flap that swings toward a post, a
block that slides toward a post, and a lever that pivots next to a stop. Each family builds an
Assembly (the contract in src/tolerance_arena/assembly/types.py) from named, bounded
parameters and has a closed-form reference distance that does not use the kernel.
src/tolerance_arena/assembly/families.pyholds the ids, versions, parameters,build,reference_distanceandplanted.src/tolerance_arena/assembly/references.pyholds the closed forms. It imports onlymathandcollections.abc.- The tests are
tests/assembly/test_assembly_references.py(hand values, no kernel),tests/assembly/test_assembly_families.py(bounds, refusals, planted numbers, this document) andtests/assembly/test_assembly_families_native.py(the kernel against the reference). - The evidence of the run that produced these numbers is in
docs/assembly-log/families.md.
Frame and placement
Every family is planar. Its solids stand on z = 0 and share one height, so the minimum distance between two solids is the planar distance between their outlines. Lengths are millimetres and angles are degrees. The joint origin is the world origin in every family.
The deviation moves the fixed part by delta along its direction. The moving part gets the joint
motion q: a revolute joint turns it counter-clockwise about +Z by q degrees, a prismatic joint
slides it by q mm along +X. The joint range is 0 to the limit parameter of the family. The
deviation range is minus to plus max_deviation_mm.
Parameters and refusals
A parameter name ends in its unit, _mm or _deg, and every parameter has closed bounds. The
code refuses, with a message that names the field, an unknown family id, an unknown parameter,
a missing parameter, a value that is not a finite number (booleans and strings included), a value
outside its bounds, and a q or delta outside its range. Nothing is clamped or repaired. A
refusal happens before any solid exists.
Every family shares two parameters: max_deviation_mm and minimum_mm, the requirement, which is
the smallest allowed gap between the two parts.
Functions
family_ids()andfamily(id)list and describe the families.validate_params(id, params)returns a checked copy of the parameters as floats.build(id, params)returns the nominalAssembly.joint_range(id, params)anddeviation_range(id, params)return the two ranges.reference_distance(id, params, q, delta)returns the gap at a pose, 0 when the parts touch, overlap or contain one another.planted(id)returns the planted parameters, the requirement, the adverse deviation, the four-point grid over the joint range and the interior pose.
hinged-flap-post
Version 1. Revolute. A flap hinged along one edge swings toward a cylindrical post. The hinge is
the z axis through the origin. Before it swings, the flap spans x from 0 to flap_length_mm and
y within half flap_thickness_mm of the x axis. The deviation moves the post along x.
| Parameter | Low | High | Unit | Meaning |
|---|---|---|---|---|
flap_length_mm | 5 | 100 | mm | Flap extent along x, from the hinge to its tip. |
flap_thickness_mm | 0.5 | 20 | mm | Flap extent along y, centred on the hinge line. |
flap_width_mm | 1 | 50 | mm | Flap extent along the hinge axis z; every solid of the family has this height. |
post_x_mm | -100 | 100 | mm | Nominal x of the post axis, before the deviation. |
post_y_mm | -100 | 100 | mm | Nominal y of the post axis. |
post_radius_mm | 0.5 | 20 | mm | Radius of the cylindrical post. |
swing_deg | 5 | 180 | deg | The joint range is 0 to this angle. |
max_deviation_mm | 0.1 | 5 | mm | The deviation delta ranges from minus this value to plus this value. |
minimum_mm | 0.1 | 10 | mm | The requirement: the smallest allowed gap. |
Reference: turn the post centre by minus q about the hinge, which puts the flap back at its
start. The gap is the distance from that point to the rectangle, less the post radius. It is 0
when the centre lies inside the rectangle or the post surface overlaps it.
Planted configuration: flap_length_mm 41.5, flap_thickness_mm 2, flap_width_mm 10, post
axis at (32, 32), post_radius_mm 2, swing_deg 90, max_deviation_mm 1.2, minimum_mm 1.5.
The post axis is 45.25 mm from the hinge at 45 degrees. The adverse deviation is -1.2 mm: it
moves the post to (30.8, 32), 44.41 mm from the hinge at 46.1 degrees. The tip corners of the flap
sweep a circle of radius 41.51 mm, so the gap between tip and post falls to about
44.41 - 41.51 - 2 = 0.90 mm when the flap points near 46 degrees.
At the adverse deviation the gap is below 1.5 mm from 42.1 to 50.1 degrees and at or above it elsewhere on the 900-step sweep. The four-point grid over the joint range is 0, 30, 60 and 90 degrees. None of them falls in that window.
| q (deg) | Reference (mm) | Kernel (mm) | Against the 1.5 mm requirement |
|---|---|---|---|
| 0 | 29.0000 | 29.0000 | at or above |
| 30 | 9.3735 | 9.3735 | at or above |
| 60 | 7.8071 | 7.8071 | at or above |
| 90 | 27.8000 | 27.8000 | at or above |
| 45 | 0.9063 | 0.9063 | below: violated |
The smallest gap over the joint range is 1.743 mm at delta 0 and 0.902 mm at delta -1.2 (900 even steps). The nominal assembly satisfies the requirement and the deviation causes the violation.
sliding-block-post
Version 1. Prismatic. A block slides along x toward a cylindrical post. Before it slides, the block
spans x from 0 to block_length_mm and y within half block_width_mm of the x axis. The
deviation moves the post along y.
| Parameter | Low | High | Unit | Meaning |
|---|---|---|---|---|
block_length_mm | 1 | 100 | mm | Block extent along x, the direction it slides. |
block_width_mm | 1 | 50 | mm | Block extent along y, centred on the slide line. |
height_mm | 1 | 50 | mm | Extent along z of the block and the post. |
post_x_mm | -100 | 300 | mm | Nominal x of the post axis. |
post_y_mm | -100 | 100 | mm | Nominal y of the post axis, before the deviation. |
post_radius_mm | 0.5 | 20 | mm | Radius of the cylindrical post. |
travel_mm | 5 | 300 | mm | The joint range is 0 to this distance. |
max_deviation_mm | 0.1 | 5 | mm | The deviation delta ranges from minus this value to plus this value. |
minimum_mm | 0.1 | 10 | mm | The requirement: the smallest allowed gap. |
Reference: slide the post by minus q along x, which puts the block back at its start. The gap is
the distance from that point to the rectangle, less the post radius, and 0 when the centre lies
inside or the surface overlaps.
Planted configuration: block_length_mm 12, block_width_mm 8, height_mm 10, post axis at
(66, 8.4), post_radius_mm 2, travel_mm 120, max_deviation_mm 1.2, minimum_mm 1.5. The
block face at y = 4 and the post surface at y = 6.4 leave 2.4 mm. The adverse deviation is
-1.2 mm: it moves the post to y = 7.2 and leaves 1.2 mm. The block passes beside the post while
its x span, q to q + 12, contains x = 66, that is for q from 54 to 66 mm. Near the ends of that
stretch the corner gives the gap.
At the adverse deviation the gap is below 1.5 mm from 52.6 to 67.4 mm and at or above it elsewhere on the 900-step sweep. The four-point grid is 0, 40, 80 and 120 mm. None of them falls in that window.
| q (mm) | Reference (mm) | Kernel (mm) | Against the 1.5 mm requirement |
|---|---|---|---|
| 0 | 52.0947 | 52.0947 | at or above |
| 40 | 12.3611 | 12.3611 | at or above |
| 80 | 12.3611 | 12.3611 | at or above |
| 120 | 52.0947 | 52.0947 | at or above |
| 60 | 1.2000 | 1.2000 | below: violated |
The smallest gap over the joint range is 2.400 mm at delta 0 and 1.200 mm at delta -1.2 (900 even steps). The nominal assembly satisfies the requirement and the deviation causes the violation.
lever-stop
Version 1. Revolute. A lever bar pivots about the origin next to a fixed rectangular stop. Before
it turns, the lever spans x from -lever_tail_mm to lever_length_mm and y within half
lever_width_mm of the x axis. The stop is centred stop_radius_mm from the pivot toward
stop_angle_deg. It extends half stop_depth_mm along its normal, which points the same way, and
half stop_width_mm across it. The deviation moves the stop along its normal.
| Parameter | Low | High | Unit | Meaning |
|---|---|---|---|---|
lever_length_mm | 5 | 150 | mm | Lever extent from the pivot to its tip. |
lever_tail_mm | 0 | 50 | mm | Lever extent from the pivot to its other end. |
lever_width_mm | 0.5 | 30 | mm | Lever extent across its length, centred on it. |
height_mm | 1 | 50 | mm | Extent along z of the lever and the stop. |
stop_radius_mm | 5 | 200 | mm | Distance from the pivot to the stop centre. |
stop_depth_mm | 0.5 | 50 | mm | Stop extent along its normal. |
stop_width_mm | 0.5 | 100 | mm | Stop extent across its normal. |
stop_angle_deg | -180 | 180 | deg | Direction of the stop from the pivot, also the direction of its normal. |
swing_deg | 5 | 180 | deg | The joint range is 0 to this angle. |
max_deviation_mm | 0.1 | 5 | mm | The deviation delta ranges from minus this value to plus this value. |
minimum_mm | 0.1 | 10 | mm | The requirement: the smallest allowed gap. |
Reference: both outlines are rectangles with four corners. The gap is the minimum over the 16 pairs of segments, one from each outline. It is 0 when two segments cross, touch or overlap, and when a corner of one rectangle lies inside the other, which covers a rectangle that contains the other without any crossing segment.
Planted configuration: lever_length_mm 40, lever_tail_mm 5, lever_width_mm 4, height_mm 10,
stop_radius_mm 45.5, stop_depth_mm 6, stop_width_mm 10, stop_angle_deg 45, swing_deg 90,
max_deviation_mm 1.2, minimum_mm 1.5. The inner face of the stop lies 42.5 mm from the pivot.
The adverse deviation is -1.2 mm: it moves that face to 41.3 mm. At q = 45 degrees the tip face of
the lever, at 40 mm, is parallel to it and 1.3 mm away.
At the adverse deviation the gap is below 1.5 mm from 35.7 to 54.3 degrees and at or above it elsewhere on the 900-step sweep. The four-point grid is 0, 30, 60 and 90 degrees. None of them falls in that window.
| q (deg) | Reference (mm) | Kernel (mm) | Against the 1.5 mm requirement |
|---|---|---|---|
| 0 | 23.6680 | 23.6680 | at or above |
| 30 | 4.0380 | 4.0380 | at or above |
| 60 | 4.0380 | 4.0380 | at or above |
| 90 | 23.6680 | 23.6680 | at or above |
| 45 | 1.3000 | 1.3000 | below: violated |
The smallest gap over the joint range is 2.450 mm at delta 0 and 1.250 mm at delta -1.2 (900 even steps). The nominal assembly satisfies the requirement and the deviation causes the violation.
Where the numbers come from
- The reference column comes from
reference_distanceand the kernel column fromnative.measure_distanceon solids placed by a local helper intests/assembly/test_assembly_families_native.py. Both are printed by that test with-s. tests/assembly/test_assembly_families.pyand the native test check that every number above matches what the code computes, so a change in the code fails the document check.- The kernel and the reference agree within 1e-6 mm on more than 200 poses per family: the grid, the
ends of both ranges, poses 0.05 mm from contact, overlapping poses and random poses. The run and
its largest differences are in
docs/assembly-log/families.md.
Limits
- The families are planar and the reference models that plane only. A configuration whose solids differ in height is outside the family.
- The reference distance is a check on the kernel and on the solids a family builds. It does not stand in for a kernel measurement and it never produces a verdict.
- The planted configurations show one violation hidden from a four-point grid. They are not a claim about the share of designs in a family with that property.