Use build_router.py to build the Rust router:
python build_router.pyThis builds the Rust module, copies the library to the correct location, and verifies the version. Do not run cargo build directly.
Important: When making changes to the Rust router, bump the version in rust_router/Cargo.toml and update the version history in rust_router/README.md.
The project uses kicad_parser module to parse KiCad PCB files:
from kicad_parser import parse_kicad_pcb, Pad, Footprint, PCBData
pcb = parse_kicad_pcb('path/to/file.kicad_pcb')pcb.footprints- Dict[str, Footprint] keyed by reference (e.g., 'U9', 'R1')pcb.nets- Dict[int, Net] keyed by net_idpcb.segments- List of track segmentspcb.vias- List of vias
footprint.reference- Component reference (e.g., 'U9')footprint.footprint_name- Footprint library name (e.g., 'interf_u:PGA120')footprint.pads- List[Pad] of padsfootprint.x,footprint.y- Footprint positionfootprint.rotation- Rotation in degreesfootprint.layer- Layer (e.g., 'F.Cu')
pad.pad_number- Pad identifier (e.g., 'H2', '1')pad.net_id- Net ID (int)pad.net_name- Net name (e.g., '/PC-A7')pad.global_x,pad.global_y- Absolute positionpad.local_x,pad.local_y- Position relative to footprintpad.size_x,pad.size_y- Pad dimensionspad.shape- 'circle', 'oval', 'rect', etc.pad.layers- List of layer namespad.drill- Drill diameter (0 for SMD, >0 for through-hole)pad.component_ref- Parent component referencepad.pinfunction,pad.pintype- Pin metadata
- Through-hole pads (
pad.drill > 0) block tracks on ALL layers - SMD pads (
pad.drill == 0) only block their specific layer - Even unconnected through-hole pads (net_id=0) physically block tracks
net.net_id- Net ID (int)net.name- Net name stringnet.pads- List[Pad] of connected pads
segment.start_x,segment.start_y- Start pointsegment.end_x,segment.end_y- End pointsegment.width- Track widthsegment.layer- Layer namesegment.net_id- Net ID
via.x,via.y- Positionvia.size- Via outer diametervia.drill- Drill diametervia.layers- Layer spanvia.net_id- Net ID