From 74be0db04a0dfdb0653b73eb09654ad22341fa6d Mon Sep 17 00:00:00 2001 From: Jacob Bower <1978924+jbower-fb@users.noreply.github.com> Date: Tue, 13 Feb 2024 20:42:24 +0800 Subject: [PATCH] Add 'solderMaskMargin' parameter to Tooling --- kikit/panelize.py | 11 ++++++++--- kikit/panelize_ui_impl.py | 5 +++-- kikit/panelize_ui_sections.py | 3 +++ kikit/resources/panelizePresets/default.json | 1 + kikit/resources/panelizePresets/jlcTooling.json | 5 +++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kikit/panelize.py b/kikit/panelize.py index add85828..2745a5c2 100644 --- a/kikit/panelize.py +++ b/kikit/panelize.py @@ -1513,7 +1513,9 @@ def makeCutsToLayer(self, cuts, layer=Layer.Cmts_User, prolongation=fromMm(0)): def addNPTHole(self, position: VECTOR2I, diameter: KiLength, paste: bool=False, ref: Optional[str]=None, - excludedFromPos: bool=False) -> None: + excludedFromPos: bool=False, + solderMaskMargin: Optional[KiLength] = None, + ) -> None: """ Add a drilled non-plated hole to the position (`VECTOR2I`) with given diameter. The paste option allows to place the hole on the paste layers. @@ -1523,6 +1525,8 @@ def addNPTHole(self, position: VECTOR2I, diameter: KiLength, for pad in footprint.Pads(): pad.SetDrillSize(toKiCADPoint((diameter, diameter))) pad.SetSize(toKiCADPoint((diameter, diameter))) + if solderMaskMargin is not None: + footprint.SetLocalSolderMaskMargin(solderMaskMargin) if paste: layerSet = pad.GetLayerSet() layerSet.AddLayer(Layer.F_Paste) @@ -1595,7 +1599,7 @@ def addCornerFiducials(self, fidCount: int, horizontalOffset: KiLength, paste, ref = f"KiKit_FID_B_{i+1}") def addCornerTooling(self, holeCount, horizontalOffset, verticalOffset, - diameter, paste=False): + diameter, paste=False, solderMaskMargin: Optional[KiLength]=None): """ Add up to 4 tooling holes to the top-left, top-right, bottom-left and bottom-right corner of the board (in this order). This function expects @@ -1604,7 +1608,8 @@ def addCornerTooling(self, holeCount, horizontalOffset, verticalOffset, The offsets are measured from the outer edges of the substrate. """ for i, pos in enumerate(self.panelCorners(horizontalOffset, verticalOffset)[:holeCount]): - self.addNPTHole(pos, diameter, paste, ref=f"KiKit_TO_{i+1}", excludedFromPos=False) + self.addNPTHole(pos, diameter, paste, ref=f"KiKit_TO_{i+1}", excludedFromPos=False, + solderMaskMargin=solderMaskMargin) def addMillFillets(self, millRadius): """ diff --git a/kikit/panelize_ui_impl.py b/kikit/panelize_ui_impl.py index 613c0ea8..14a9592f 100644 --- a/kikit/panelize_ui_impl.py +++ b/kikit/panelize_ui_impl.py @@ -501,11 +501,12 @@ def buildTooling(preset, panel): hoffset, voffset = toolingPreset["hoffset"], toolingPreset["voffset"] diameter = toolingPreset["size"] paste = toolingPreset["paste"] + soldermaskmargin = toolingPreset["soldermaskmargin"] if type == "3hole": - panel.addCornerTooling(3, hoffset, voffset, diameter, paste) + panel.addCornerTooling(3, hoffset, voffset, diameter, paste, soldermaskmargin) return if type == "4hole": - panel.addCornerTooling(4, hoffset, voffset, diameter, paste) + panel.addCornerTooling(4, hoffset, voffset, diameter, paste, soldermaskmargin) return raise PresetError(f"Unknown type '{type}' of tooling specification.") except KeyError as e: diff --git a/kikit/panelize_ui_sections.py b/kikit/panelize_ui_sections.py index 0961b2e5..a5cfa865 100644 --- a/kikit/panelize_ui_sections.py +++ b/kikit/panelize_ui_sections.py @@ -540,6 +540,9 @@ def ppFraming(section): "paste": SBool( typeIn(["3hole", "4hole", "plugin"]), "Include holes on the paste layer"), + "soldermaskmargin": SLength( + typeIn(["3hole", "4hole", "plugin"]), + "Solder mask expansion/margin"), "code": SPlugin( plugin.ToolingPlugin, typeIn(["plugin"]), diff --git a/kikit/resources/panelizePresets/default.json b/kikit/resources/panelizePresets/default.json index c0ee579d..3551bad0 100644 --- a/kikit/resources/panelizePresets/default.json +++ b/kikit/resources/panelizePresets/default.json @@ -85,6 +85,7 @@ "voffset": "0mm", "size": "2mm", "paste": false, + "soldermaskmargin": "0mm", "code": "none", "arg": "" }, diff --git a/kikit/resources/panelizePresets/jlcTooling.json b/kikit/resources/panelizePresets/jlcTooling.json index 86596e78..2df8e309 100644 --- a/kikit/resources/panelizePresets/jlcTooling.json +++ b/kikit/resources/panelizePresets/jlcTooling.json @@ -2,6 +2,7 @@ "tooling": { "style": "3hole", "size": "1.152mm", - "paste": false + "paste": false, + "soldermaskmargin": "1.3mm" } -} \ No newline at end of file +}