skidl.tools.kicad9.backend module

Concrete KiCad-9 implementation of the tool-agnostic SchematicBackend.

Every method here delegates VERBATIM to the existing functions in sexp_schematic.py — this is a thin adapter so the agnostic decision layer (schematics/decisions.py) can reach the KiCad render geometry and emission primitives through the interface in schematics/backend.py without importing skidl.tools.kicad9 directly. The KiCad coordinate math and S-expression syntax stay in sexp_schematic.py; nothing here changes output.

class skidl.tools.kicad9.backend.Kicad9Backend[source]

Bases: object

Adapter exposing kicad9 geometry + emission as a SchematicBackend.

Interface status (honest): geometry queries (pin_render_pos, pin_render_dir, is_power_net_name, render_xy, label_bbox) are LIVE — consumed by schematics.decisions. Among emission primitives, emit_wire and emit_no_connect ARE on the live path; emit_label/emit_part/ emit_power_symbol/emit_junction are defined for completeness but the renderer still uses the module-level functions for those. solve_snap_tx is DEFERRED (raises; see doc P1b).

apply_label_deconfliction(elements, node, sheet_tx)[source]

Read global_label/wire Sexps, run the agnostic deconfliction decision, then mutate label at coords + append connecting wires.

The Sexp reading and mutation (tool-specific) stay here; the overlap detection + nudge-target decision lives in schematics.decisions.deconflict_labels.

emit_junction(x, y)[source]
emit_label(pin, sheet_tx, *, at=None, angle=None, force=False)[source]
emit_no_connect(x, y, *, uuid_seed=None)[source]
emit_part(part, sheet_tx, uuid_path)[source]
emit_power_symbol(pin, net_name, sheet_tx)[source]
emit_wire(x1, y1, x2, y2, *, net_name=None, uuid_seed=None)[source]

Build a bare wire Sexp at render-mm coords.

Mirrors the inline wire construction in the decision functions; the caller supplies the UUID seed so emitted UUIDs match the originals.

is_power_net_name(name)[source]
label_bbox(text)[source]

Rendered net-label box size in mm.

Matches the fixed box that _deconflict_labels uses today (LABEL_W x LABEL_H), so the relocated deconfliction is byte-identical.

pin_render_dir(pin, sheet_tx)[source]

Render-space pin direction == calc_pin_dir.

Note: the present calc_pin_dir ignores sheet_tx (see the architecture doc, section 3 / section 6). Folding sheet_tx in would change output, so this adapter preserves the current behavior exactly.

pin_render_pos(pin, sheet_tx)[source]

KiCad render-mm position of a pin == _kicad_pin_pos.

render_xy(lx, ly, part, sheet_tx)[source]

Render-mm of an arbitrary part-local point == _render_xy.

round_mm(val)[source]
solve_snap_tx(part, my_pin, target_render_xy, extend_dir, sheet_tx)[source]
supports_snap = True