Skip to content

Add via-vs-trace clearance check and integrate into exports and runners#135

Merged
imrishabh18 merged 3 commits intomainfrom
codex/task-title
Apr 19, 2026
Merged

Add via-vs-trace clearance check and integrate into exports and runners#135
imrishabh18 merged 3 commits intomainfrom
codex/task-title

Conversation

@imrishabh18
Copy link
Copy Markdown
Member

Motivation

  • Detect PCB vias that violate minimum clearance to unrelated trace segments to catch potential manufacturing/DRC issues.

Description

  • Add lib/check-via-trace-clearance.ts which implements checkViaTraceClearance using segmentToCircleMinDistance, connectivity checks, and returns pcb_via_trace_clearance_error objects when clearance is below the configured minimum.
  • Wire the new check into the public API by exporting checkViaTraceClearance from index.ts and including it in runAllRoutingChecks in lib/run-all-checks.ts.
  • Update README.md to document the new checkViaTraceClearance function and list it in the routing checks overview.
  • Add unit tests at tests/lib/check-via-trace-clearance.test.ts and update package.json dev/peer dependency ordering and version metadata.

Testing

  • Ran the unit tests with bun test, which executed tests/lib/check-via-trace-clearance.test.ts and the two added assertions passed.
  • No regressions were observed in the new test runs (all executed tests succeeded).

Codex Task

Copy link
Copy Markdown
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a pcb snapshot test would improve this, since the svg snapshots usually show the errors and where the center is (i think)

Comment thread lib/check-via-trace-clearance.ts Outdated
actual_clearance: gap,
center: {
x: (via.x + (segment.x1 + segment.x2) / 2) / 2,
y: (via.y + (segment.y1 + segment.y2) / 2) / 2,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't the best center fwiw- this will always appear "off", you have to ask "which point on the segment is closest to the via", then go between that closest point and the via. The closest point can be computed by "projecting" the via point onto the segment, which has a small formula

Also best to have a pcb visual snapshot for this to see the point

@imrishabh18 imrishabh18 merged commit 521ac35 into main Apr 19, 2026
5 checks passed
@imrishabh18 imrishabh18 deleted the codex/task-title branch April 19, 2026 06:02
@tscircuitbot
Copy link
Copy Markdown
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants