Expand description
Wire-harness routing: the document’s wireHarness block, the sided port
graph, per-connection routes and the bundle solids — solved at the tail of
every run like assembly (see wire_harness.rs).
Wire harness — the document’s wireHarness block, the SIDED port graph,
per-connection routing, and the bundle solids. Solved at the tail of every
history run (like assembly), against the ports and spline segments the
run published.
§The wireHarness block
{ connections: [{ id, name, from, to, diameter }], idCounter, buildBundles, cutMargin } on the history request, round-tripped through the saved
document. from / to are PORT FEATURE IDS (references are ids, never
labels — the panel shows the ports’ portNames and stores their ids).
idCounter mints wire-N ids monotonically, like the feature counter.
buildBundles (default true) switches the bundle solids off while keeping
the routing. cutMargin (default 0, omitted at 0) is the amount the BOM adds
to every wire’s routed length to give its cut length; the router never
reads it.
§The network
- A port is a PORT feature’s
PortRecord: a point and a unit direction. Every port has two SIDES:Aalong the direction,Bagainst it. A wire that enters a port on one side must leave it on the other — that is the whole routing rule, and what makes a waypoint a pass-through rather than a junction box. - A segment is a SPLINE feature whose first and last anchors attach to
two DIFFERENT ports. The kernel builds the curve from the ports’ live
placements (
features/spline.rs), so the segment’s geometry is authoritative: the PHYSICAL side a segment occupies at each port is read off the curve’s end tangent —sign(t_out · dir)at the first port,sign(−t_in · dir)at the last (the wire ARRIVES from the opposite half-space, so an anchor attached on side A at the end of a spline sits on the port’s side B). The stored attachment side is how the spline was authored; the tangent is where the wire actually is. - Segment weight = the chain’s arc length.
§The sided digraph (the retired sided_ab_graphs builder, kept exactly)
Nodes are {port}/A and {port}/B. A segment joining P/X to Q/Y adds
two directed edges: P/X → Q/inv(Y) and Q/Y → P/inv(X), with
inv(A) = B. Reading an edge as “leave P through X, arrive at Q on Y, and
you are now poised to leave Q through inv(Y)” is what encodes the pass-
through rule. A connection routes from {from}/A or {from}/B to {to}/A
or {to}/B (four Dijkstra queries, the shortest wins). A route that visits
the same port twice is refused and the constrained best-first search (state
= node + visited-port set) runs instead; if that finds nothing either the
connection stays unrouted with the port-reuse status. Endpoints must be
terminations (a waypoint is a pass-through, never a cable end).
§Bundles
Every routed connection contributes its diameter to each segment it
crosses. A segment’s bundle diameter is sqrt(Σ d² / 0.75) · 1.1 (a 75 %
packing efficiency and a 10 % safety factor — the established formula), and
its solid is a circle of that diameter swept along the spline’s exact chain
(sweep_profile_along_chain_with_stations), named WireHarness:{spline}
with faces …:Wall0, …:Wall1, …:Start, …:End. The bundle solids ride
an extra FeatureResult (id WIRE_HARNESS_FEATURE_ID, type
WIRE_HARNESS_FEATURE_TYPE) appended to the run’s results, so the
display pipeline shows them through the standard solid path (rendering
requirement R31). A bundle that fails to build reports its error on the
bundle row and never halts the run.
§Caching
The tail caches its last outcome per thread against a fingerprint of the
block + the network (port records + segment chains): an unchanged harness
replays (reused, the same resident handles) instead of re-sweeping —
which keeps the main-thread execute_history replays the engine makes for
consumed-name / assembly sync cheap. A changed fingerprint frees the old
bundle handles before building; clear_history_cache frees them too.
Structs§
- Attachment
- A spline anchor’s port attachment:
{ portRef, side }under the anchor’sattachmentkey.sidedefaults toAwhen absent. - Route
Result - One connection’s route.
- Wire
Harness Bundle - One segment’s bundle.
- Wire
Harness Connection - One wire: its id, display name, endpoint PORT ids and diameter.
- Wire
Harness Endpoint - A connection point as an endpoint choice.
- Wire
Harness Report - The routing outcome of one run.
- Wire
Harness Segment - A network segment: the spline id, its two ports with the PHYSICAL side the wire occupies at each, and its length.
- Wire
Harness State - The document’s
wireHarnessblock.
Enums§
- Bundle
Status - Why a segment’s bundle solid is or is not there.
- Port
Side - A port side:
Aalong the port direction,Bagainst it. - Route
Status - Why a connection is or is not routed.
Constants§
- BUNDLE_
SOLID_ PREFIX - The prefix of every bundle solid name (
WireHarness:{spline id}). - WIRE_
HARNESS_ FEATURE_ ID - The id of the appended tail result (and the creator the display pipeline records for every bundle solid). Never a history feature.
- WIRE_
HARNESS_ FEATURE_ TYPE - The type of the appended tail result.
Functions§
- bundle_
diameter - The bundle diameter for a set of wire diameters:
sqrt(Σ d² / 0.75) · 1.1— 75 % packing efficiency and a 10 % safety factor. Zero for no wires. - clear_
cache - Free the cached bundle solids (a document switch, or a rebuild).