Skip to content

Commit

Permalink
add adhesive option for panelize tooling section
Browse files Browse the repository at this point in the history
  • Loading branch information
Wannes Sels committed Nov 5, 2022
1 parent 222512c commit 265ab84
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
17 changes: 11 additions & 6 deletions kikit/panelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,20 +1312,25 @@ def makeCutsToLayer(self, cuts, layer=Layer.Cmts_User, prolongation=fromMm(0)):
segment.SetWidth(fromMm(0.3))
self.board.Add(segment)

def addNPTHole(self, position, diameter, paste=False):
def addNPTHole(self, position, diameter, paste=False, adhesive=False):
"""
Add a drilled non-plated hole to the position (`wxPoint`) with given
diameter. The paste option allows to place the hole on the paste layers.
The adhesive option allows to place the hole on the adhesive layers.
"""
footprint = pcbnew.FootprintLoad(KIKIT_LIB, "NPTH")
footprint.SetPosition(position)
for pad in footprint.Pads():
pad.SetDrillSize(pcbnew.wxSize(diameter, diameter))
pad.SetSize(pcbnew.wxSize(diameter, diameter))
if paste:
if paste or adhesive:
layerSet = pad.GetLayerSet()
layerSet.AddLayer(Layer.F_Paste)
layerSet.AddLayer(Layer.B_Paste)
if paste:
layerSet.AddLayer(Layer.F_Paste)
layerSet.AddLayer(Layer.B_Paste)
if adhesive:
layerSet.AddLayer(Layer.F_Adhes)
layerSet.AddLayer(Layer.B_Adhes)
pad.SetLayerSet(layerSet)
self.board.Add(footprint)

Expand Down Expand Up @@ -1378,7 +1383,7 @@ def addCornerFiducials(self, fidCount, horizontalOffset, verticalOffset,
self.addFiducial(pos, copperDiameter, openingDiameter, True)

def addCornerTooling(self, holeCount, horizontalOffset, verticalOffset,
diameter, paste=False):
diameter, paste=False, adhesive=False):
"""
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
Expand All @@ -1387,7 +1392,7 @@ def addCornerTooling(self, holeCount, horizontalOffset, verticalOffset,
The offsets are measured from the outer edges of the substrate.
"""
for pos in self.panelCorners(horizontalOffset, verticalOffset)[:holeCount]:
self.addNPTHole(pos, diameter, paste)
self.addNPTHole(pos, diameter, paste, adhesive)

def addMillFillets(self, millRadius):
"""
Expand Down
5 changes: 3 additions & 2 deletions kikit/panelize_ui_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,12 @@ def buildTooling(preset, panel):
hoffset, voffset = toolingPreset["hoffset"], toolingPreset["voffset"]
diameter = toolingPreset["size"]
paste = toolingPreset["paste"]
adhesive = toolingPreset["adhesive"]
if type == "3hole":
panel.addCornerTooling(3, hoffset, voffset, diameter, paste)
panel.addCornerTooling(3, hoffset, voffset, diameter, paste, adhesive)
return
if type == "4hole":
panel.addCornerTooling(4, hoffset, voffset, diameter, paste)
panel.addCornerTooling(4, hoffset, voffset, diameter, paste, adhesive)
return
raise PresetError(f"Unknown type '{type}' of tooling specification.")
except KeyError as e:
Expand Down
3 changes: 3 additions & 0 deletions kikit/panelize_ui_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ def ppFraming(section):
"paste": SBool(
typeIn(["3hole", "4hole"]),
"Include holes on the paste layer"),
"adhesive": SBool(
typeIn(["3hole", "4hole"]),
"Include holes on the adhesive layer"),
"code": SPlugin(
plugin.ToolingPlugin,
typeIn(["plugin"]),
Expand Down
1 change: 1 addition & 0 deletions kikit/resources/panelizePresets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"hoffset": "0mm",
"voffset": "0mm",
"paste": false,
"adhesive": false,
"code": "none",
"arg": ""
},
Expand Down

0 comments on commit 265ab84

Please sign in to comment.