CM3D-016: A movable joint and its RigidJoint share one label
Context
Every movable connection is a build123d joint: the fixed part carries a RevoluteJoint or a LinearJoint, and the moving part carries a RigidJoint.
cm3d inspect and cm3d look place a moving part in a pose and sweep it through its range, to find collisions that only happen in motion.
To do that, the tools must know which two joints belong together.
build123d 0.13 records a connection in Joint.connected_to, but only after connect_to has run, and only on the joint that moved the other part.
The tools start from part functions that return parts nobody has connected yet, so connected_to is empty there.
Until now the two joints of a pair had different labels, for example lid_hinge on the case and hinge on the lid.
Decision Drivers
-
No extra wiring: a module that adds a hinge must not also register the hinge somewhere else.
-
Works before connect_to: the tools resolve the parts from their functions, so they must find a pair that nothing has connected yet.
-
One source per name: the label is a constant, so the fixed part and the moving part cannot drift apart.
Decision
The movable joint on the fixed part and the RigidJoint on the moving part carry the same label.
The fixed part’s module publishes the label as a constant, for example ARM_HINGE = "arm hinge", and the moving part uses that constant.
cm3d.tools.motion pairs joints by this label.
A label with no partner, with two movable joints, or on a CylindricalJoint or BallJoint is an error only when --pose or --sweep asks for it.
Alternatives Considered
An explicit pair option on the CLI
Each call names both joints, for example --joint "spine/arm hinge=arm/hinge".
Rejected: every call repeats knowledge that belongs in the model, and a test or a script must repeat it too.
Consequences
-
Good: a new hinge works in
cm3d inspect --sweepandcm3d look --posewithout any other change. -
Good: tests use the same constant on both sides, so a renamed label breaks loudly.
-
Bad: two moving parts on the same fixed joint label (for example two bottle slots with one spine each) need distinct labels or a target that holds only one of them.
-
Bad: the label is a convention that build123d does not check, so the build123d skill must teach it.