Repository navigation
fix(smtpad): emit per-side solder mask margins - #5929
Open
siribi007-del wants to merge 1 commit into
Open
siribi007-del wants to merge 1 commit into
siribi007-del wants to merge 1 commit into
Conversation
<smtpad solderMaskMarginLeft/Right/Top/Bottom> were accepted by the props schema but never written to pcb_smtpad, so rect and rotated_rect pads lost them even though circuit-json has soldermask_margin_left/right/ top/bottom. The margins are given in the pad's own frame. Map each one through the pad's global transform (component rotation and bottom-side flip) and its own ccwRotation into the frame of the emitted pad, so a 90 degree rotation or a bottom placement keeps each margin on the same physical edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Motivation
Fine-pitch pads often need a tight mask web between neighbours but a larger opening at the toe, which is what
solderMaskMarginLeft/Right/Top/Bottomon<smtpad>are for. Core accepts those props but never writes them topcb_smtpad, even though circuit-json hassoldermask_margin_left/right/top/bottomon rect and rotated_rect pads and circuit-to-svg already reads them (circuit-to-svg#481).Reproduction
On main the pad comes out as
{ shape: "rect", ... }with nosoldermask_margin_*fields.Passing the values straight through is not enough: the margins are written in the pad's own frame, and the emitted pad is in the board frame. With
pcbRotation={90}the pad's left edge faces -y, and onlayer="bottom"the footprint is mirrored in x (a pad atpcbX={2}lands at x = -2), so left and right swap.Change
mapSoldermaskSideMargins(new,lib/utils/pcb/) sends each side's outward direction through the pad's global transform (plus its ownccwRotationforrotated_rect) and into the frame of the emitted pad (itsccw_rotation), then assigns the margin to whichever side it lands on.SmtPadspreads the result into the three rect / rotated_rect inserts. Pads without per-side margins emit nothing new.Validation
tests/components/primitive-components/smtpad-soldermask-side-margins.test.tsx(7 tests): pass-through, 90° rotation, bottom flip, flip + 90°, 45° (rotated_rect output),shape="rotated_rect"withccwRotationon top and bottom, and no per-side fields when none are set. I checked the rotation and flip expectations against where an off-centre pad actually lands, not against the new function.smtpadorsolderMask(315 files) pass, except the tworepro-a13-ddr-*tests, which fail the same way on main.bunx tsc --noEmitand biome are clean. tscircuit-pullrequest-deterministic-checks reports 0 errors.Before / after (5 pads at 0.5 mm pitch, L/R 0.03, top 0.15, bottom 0.05 mm). circuit-to-svg only draws the mask for covered pads, so this is drawn straight from the
pcb_smtpadfields:Not in this PR: circuit-json-to-gerber does not read the per-side fields yet (circuit-json-to-gerber#277 is open for that), so the mask layer in exported gerbers still uses
soldermask_margin.AI-assisted (Claude); I ran and checked the tests locally.