feat(drc): Add overlapping pad detection to Board DRC system(#1466) #1469
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.
Fix Overlapping SMT Pads DRC Issue
🎯 Bounty Claim
Claiming bounty #1466 - Fix overlapping SMT pads issue in DRC system
📋 Problem Statement
The Design Rule Check (DRC) system was not properly handling overlapping SMT pads, especially when they share the same subcircuit connectivity key. This could lead to false positive errors where pads that should be allowed to overlap (due to being part of the same electrical connectivity) were being flagged as design rule violations.
🔧 Implementation Plan
Phase 1: Error Type Definition ✅
OverlappingPadError
interface with proper structurePhase 2: DRC Logic Implementation ✅
checkOverlappingPads()
functionsubcircuit_id
allowed to overlap)Phase 3: Geometric Overlap Detection ✅
Phase 4: Integration with Board DRC System ✅
Board.updatePcbDesignRuleChecks()
methodpcb_placement_error
collection as fallbackPhase 5: Comprehensive Testing ✅
🚀 Solution Overview
Key Features Implemented
Subcircuit Connectivity Awareness
Multi-Shape Support
Layer-Aware Detection
Comprehensive Error Reporting
📁 Files Modified/Created
New Files
lib/utils/drc/checkOverlappingPads.ts
- Main DRC implementationtests/drc/overlapping-pads.test.tsx
- Unit tests (6 test cases)tests/drc/overlapping-pads-integration.test.tsx
- Integration tests (3 test cases)Modified Files
lib/components/normal-components/Board.ts
- Added DRC integrationlib/components/base-components/PrimitiveComponent/PrimitiveComponent.ts
- Error handling support🧪 Test Results
All tests pass successfully:
Test Coverage
🎥 Demo
Before Fix
After Fix
🔍 Code Quality
🚀 Usage
The overlapping pad detection is now automatically integrated into the Board's DRC system and runs during the
PcbDesignRuleChecks
render phase. When overlapping pads are detected (excluding those with the same subcircuit_id), errors are inserted into the database and can be visualized in the PCB view.📊 Impact
This fix resolves the overlapping SMT pads issue by:
✅ Verification
The implementation has been thoroughly tested and verified:
Ready for review and bounty claim! 🎉