Add copper pour overlap DRC check - #190
Open
zkasuran wants to merge 1 commit into
Open
Conversation
Detect copper pours on the same layer that belong to different nets and whose filled regions overlap. Overlapping fills on different nets are physically connected copper so the two nets are shorted together. The check resolves net membership through the connectivity map so electrically tied nets are left alone, and it is wired into runAllChecks. Detection for the short reported in tscircuit/core#3074.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189
What this does
Adds
checkCopperPourOverlap, a DRC check that flags copper pours on the same layer that belong to different nets and whose filled regions overlap. Overlapping fills on different nets are physically the same copper, so the two nets are shorted together.This is the detection for the short reported in tscircuit/core#3074, where two default full-board pours on one layer each fill the whole board and overlap with no diagnostic. The pour geometry is produced by the solver in
core; this change only inspects the resultingpcb_copper_pourrecords, so it is additive and does not touch the solver.How it works
getFullConnectivityMapFromCircuitJson), so two pours that name different nets which are electrically tied read as the same net and are left alone, matchingcheckDifferentNetViaSpacing.pcb_trace_erroris emitted per overlapping pair, deduped by pour id pair, carrying the overlap center soshouldDrawErrorsrenders it.runAllRoutingChecksnext to the other net-aware checks.Tests
check-copper-pour-overlap.test.ts: overlap on different nets flags one error; same-net, different-layer, disjoint and electrically-tied nets each produce no error.copper-pour-overlap-drc-snapshot.test.ts: renders the error over the two overlapping pours withconvertCircuitJsonToPcbSvg({ shouldDrawErrors: true }).Verified locally
bun test(147 pass, 0 fail)bunx tsc --noEmitcleanbun run format:checkcleanbunx @tscircuit/dependency-checkpassesbun run buildsucceedsAI assistance
AI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: bun test, bunx tsc --noEmit, bun run format:check, dependency-check and build all pass.