route_plan_repairs
Convert DRC violation payloads into ordered PCB repair actions, classifying clearance, unrouted, antenna, and width issues and escalating cases that cannot converge.
Instructions
Turn a DRC violation payload into an ordered repair plan.
Pure Python, stateless. Classifies the pcb_run_drc payload
(or a bare violation list) into buckets (net_clearance /
pad_clearance / unrouted / antenna / width / other), then plans
actions: rip_and_reroute (worst clearance offender first),
nudge {net, dx, dy, x_mils, y_mils} for a lone
pad-clearance conflict, widen/narrow {net} for width
violations, escalate {reason} when the plan cannot converge
alone. Deltas/coordinates are integer mils.
Executor contract: apply the actions in order
(rip_and_reroute = pcb_delete_net + route that net
again via route_plan with the nets filter or a DSN
round-trip; nudge = obj_modify on the primitive nearest
(x_mils, y_mils); widen/narrow =
pcb_set_track_width; escalate = stop and surface the
reason). Then pcb_run_drc again and re-plan from the fresh
violations -- the loop's outer iteration bound is the caller's.
Args:
violations: pcb_run_drc result {violation_count, violations} or a bare list of violation dicts.
max_rounds: Rip budget for the clearance worst-offender
loop, integer >= 0 (0 = escalate-only for clearance).
Returns:
{"ok": True, "actions": [...], "rounds_used": n, "ripped_nets": [...], "counts": {bucket: n}};
{"ok": False, "reason": ...} on malformed input.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_rounds | No | ||
| violations | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||