Skip to content

feat: add via-to-pad clearance check#152

Open
harrrshall wants to merge 1 commit into
tscircuit:mainfrom
harrrshall:add-via-pad-clearance-check
Open

feat: add via-to-pad clearance check#152
harrrshall wants to merge 1 commit into
tscircuit:mainfrom
harrrshall:add-via-pad-clearance-check

Conversation

@harrrshall

Copy link
Copy Markdown

Closes #44

Adds a new DRC check, checkViaPadClearance, that flags vias placed too close to pads (pcb_smtpad and pcb_plated_hole).

Approach

  • Treats each via as a circle (outer_diameter) and measures the edge-to-edge gap to every pad.
  • Circular pads use circle-to-circle distance; rectangular pads use circle-to-bounding-box distance (consistent with how check-pad-pad-clearance treats rectangular pads).
  • Skips via/pad pairs that share no copper layer.
  • Skips vias connected to the pad's net (intentional proximity), using the connectivity map — matching check-via-trace-clearance.
  • Default minClearance is the board's min_pad_edge_to_pad_edge_clearance DRC value, falling back to the JLC minimum; overridable via the options argument.

Registered in runAllRoutingChecks and exported from index.ts.

Tests

tests/lib/check-via-pad-clearance.test.ts covers a violation, a via far from the pad, a via connected to the pad's net, and a custom minClearance. All four pass locally (bun test).

Note

circuit-json does not define a pcb_via_pad_clearance_error type yet, so the error interface is declared locally in the check. Promoting it to circuit-json would be a sensible follow-up — happy to do that if preferred.

Adds checkViaPadClearance, a DRC check that flags vias placed too close
to pads (pcb_smtpad and pcb_plated_hole). A via connected to the same net
as a pad is ignored, since that proximity is intentional. Registered in
runAllRoutingChecks and exported from index.

Closes tscircuit#44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New DRC Check: Check vias aren't too close to pads

1 participant