-
Notifications
You must be signed in to change notification settings - Fork 44
fix: implement two-layer soldermask approach for copper pours #438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: implement two-layer soldermask approach for copper pours #438
Conversation
- Refactor soldermask rendering to use two-layer approach (no boolean operations) - Fix double sorting issue - now sorts only once at the end - Extract shared helpers for soldermask cutout/overlay elements (DRY) - Fix substrate-only rendering - pure substrate without copper blending - Fix bottom layer priority so copper pours render above base soldermask - Change bottom soldermask color to green to match top layer - Add silkscreen labels to test for better visual documentation - Fix silkscreen text positioning - all labels on top layer for readability
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
there is an inconsistency with what |
…ng the pattern: Base board mask (create-svg-objects-from-pcb-board.ts): Uses soldermask-top/soldermask-bottom (the soldermask layer name) Cutouts/overlays (all other files): Use the actual element layer (top/bottom): Holes: Use view layer (ctx.layer ?? "top") since they're through-hole Plated holes: Use the extracted copperLayer from the element Copper pours: Use the layer parameter SMT pads: Use pad.layer directly
Standardized maskLayer usage across files and added comments explaining the pattern:
The distinction is:
|
ShiboSoftwareDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one time it's this:
const maskLayer = layer ?? "top"
and another time it's this:
const maskLayer = ctx.layer === "bottom" ? "soldermask-bottom" : "soldermask-top"
it should be consistent for clarity
…ayer to a layer variable first, then derive maskLayer from it. Replaced all copperLayer references with layer in the plated hole file to match the pattern and fix TypeScript errors.
Fix: Standardized maskLayer determination across files: extract the layer to a layer variable first, then derive maskLayer from it. Replaced all copperLayer references with layer in the plated hole file to match the pattern and fix TypeScript errors. |
…k in SMT pads and panel files Standardized maskLayer derivation pattern: All files now extract layer first, then derive maskLayer from it Board file: maskLayer = layer === "bottom" ? "soldermask-bottom" : "soldermask-top" Other files: maskLayer = layer Fixed SMT pads file: Added const layer = pad.layer and const maskLayer = layer Replaced all pad.layer references with layer or maskLayer as appropriate Standardized data-pcb-layer usage: Copper elements always use layer Soldermask elements always use maskLayer Fixed plated hole file: Replaced all copperLayer references with layer Added missing data-pcb-layer: maskLayer to 4 soldermask elements that were missing it Removed direct property access: No more pad.layer or ctx.layer in data-pcb-layer attributes All use extracted layer or maskLayer variables Added clarifying comments explaining when to use layer vs maskLayer in each file
|
|
update snapshots |
be10fb0 to
ecb8327
Compare
….com/RaghavArora14/circuit-to-svg into fix/copper-pour-soldermask-two-layer
seveibar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not obfuscate, there is a ton of it. Eg layer = pad.layer
lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
Outdated
Show resolved
Hide resolved
lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
Outdated
Show resolved
Hide resolved
lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
Outdated
Show resolved
Hide resolved
lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
Outdated
Show resolved
Hide resolved
seveibar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is getting better
|
done all changes |
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
Summary
Implements a two-layer soldermask approach for copper pours, following the design discussed with Rishabh. This approach avoids boolean operations and uses SVG layering instead.
Changes
Core Implementation
substrate_onlyin ID render only substrate cutout (no copper element)Technical Details
Rendering Order
soldermask-top/soldermask-bottom, priority 3)pcb_soldermask_opening, type priority 25, on actual copper layer)pcb_soldermask, type priority 40, on actual copper layer)Substrate-Only Detection
Copper pours with
substrate_onlyin their ID skip rendering the copper element, showing only the substrate cutout. This allows testing pure substrate areas without copper blending.Testing
All existing tests pass. New comprehensive test covers: