skidl.schematics.decisions module¶
Tool-agnostic schematic decision logic.
These functions decide what to draw — which overlapping-pin labels are
redundant, which co-linear power pins form a bus, where no-connect flags go,
how net labels deconflict from component bodies — and return ABSTRACT data
(sets of id(pin), lists of (x1, y1, x2, y2) segments in render-mm,
LabelPlacement data). The concrete backend (tools/kicad9) measures
geometry and emits elements; this module never imports skidl.tools.* and
never constructs a tool-native element.
All coordinates here are render-mm as returned by
backend.pin_render_pos — the single coordinate source of truth (see the
architecture doc, sections 2, 3, 6).
- skidl.schematics.decisions.deconflict_labels(labels, occupied_seed, node, backend, sheet_tx)[source]¶
Decide which net labels to nudge off component bodies.
Relocated DECISION half of
_deconflict_labels(the Sexp reading + mutation stays in the backend). Inputs are abstract:labels— list of(idx, net_name, lx, ly, langle)for everyglobal_labelelement, in element order.idxis opaque to this function (returned back so the caller can locate the element).langle is Nonemarks a record that only seeds occupancy.occupied_seed— list of(cell, owner)in element order; applied in order so later entries overwrite earlier ones at a shared cell, exactly as the original single-pass element scan did.owneris the net name for a label anchor, orNonefor a wire endpoint.
Returns
(moves, new_wires)wheremovesis a list of(idx, nx, ny)label repositions (render-mm) andnew_wiresis a list of(ax, ay, nx, ny)short connecting wires (render-mm) to preserve connectivity. The label/box geometry comes frombackend.label_bboxso box sizing is tool-specific; the math is identical to the original.
- skidl.schematics.decisions.find_no_connect_pins(node, backend, sheet_tx)[source]¶
No-connect flag positions (render-mm) for pins on an NCNet.
Returns a list of
(x, y, part_ref, pin_num)so the caller can emit a no_connect flag per NC pin with the original UUID seed. Relocated detection half of_gen_no_connect_flags; the no_connect Sexp stays in the backend.
- skidl.schematics.decisions.find_overlapping_pins(node, backend, sheet_tx, max_dist_mm=80.0)[source]¶
Pins whose labels are redundant because snap made them coincide.
Builds connected clusters of overlapping pins per net (distance < 0.01mm in RENDER space). Within each cluster only one label is needed for cross-sheet connectivity; the rest are suppressed. Returns a
setofid(pin)to suppress.Relocated from the decision body of
_find_wireable_nets(which emitted nothing). Usesbackend.pin_render_pos/backend.is_power_net_nameinstead of the module-level kicad helpers; the math is identical.
- skidl.schematics.decisions.find_power_bus_runs(node, backend, sheet_tx, max_gap_mm=10.0)[source]¶
Co-linear runs of 3+ power-net pins -> (wire segments, pins to skip).
Returns
(segments, bus_pin_ids)wheresegmentsis a list of(x1, y1, x2, y2, net_name)in render-mm (caller emits viabackend.emit_wire) andbus_pin_idsis the set ofid(pin)that should NOT get individual power symbols.Relocated DECISION half of
_gen_power_bus_wires; the wire Sexp construction stays in the backend.
