add_wires
Add multiple wire segments at once to a KiCad schematic, automatically placing junctions and splitting wires at connections while preventing accidental shorts across parts.
Instructions
Add multiple wires at once, as KiCad's wire tool adds them. Each wire dict has keys: x1, y1, x2, y2.
Following SCH_LINE_WIRE_BUS_TOOL::finishSegments (sch_line_wire_bus_tool.cpp:1168-1276 at
9.0.8): a junction goes wherever three or more wire directions, pins or sheet pins meet,
at a new wire's end or at a point already on the sheet that a new wire runs through (a
pin, a wire end), and every wire through a junction is split there, so a T, or a wire
drawn through a pin, joins in every reader. As KiCad merges the new wire with the
collinear wires of its stroke that it overlaps or meets end to end (where no junction
is), a stretch such a wire already covers is left out, and a merged run holding both
pins of a two-pin part loses the stretch between them, so drawing across a part never
shorts it. A wire of no length is left out, as KiCad's tool drops one. Existing wires
are only ever split: where KiCad's trim would cut a wire already on the sheet, the call
is refused and nothing is written. The result counts the wire nodes written and names
each junction, split, left-out and trimmed stretch; when nothing changes it says so and
writes nothing.
Args:
wires: List of wire defs [{x1, y1, x2, y2}, ...]
schematic_path: Path to .kicad_sch file. Optional; omit to use the configured default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wires | Yes | ||
| schematic_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |