Skip to content

Commit

Permalink
Properly set attributes for panel holes
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Nov 24, 2023
1 parent 17190e4 commit 8a54976
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions kikit/panelize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,8 @@ def makeMouseBites(self, cuts, diameter, spacing, offset=fromMm(0.25),
hole = cut.interpolate( i * length / (count - 1) )
if bloatedSubstrate.intersects(hole):
self.addNPTHole(toKiCADPoint((hole.x, hole.y)), diameter,
ref=f"KiKit_MB_{self.renderedMousebiteCounter}_{i+1}")
ref=f"KiKit_MB_{self.renderedMousebiteCounter}_{i+1}",
excludedFromPos=True)

def makeCutsToLayer(self, cuts, layer=Layer.Cmts_User, prolongation=fromMm(0)):
"""
Expand All @@ -1503,7 +1504,8 @@ def makeCutsToLayer(self, cuts, layer=Layer.Cmts_User, prolongation=fromMm(0)):
self.board.Add(segment)

def addNPTHole(self, position: VECTOR2I, diameter: KiLength,
paste: bool=False, ref: Optional[str]=None) -> None:
paste: bool=False, ref: Optional[str]=None,
excludedFromPos: bool=False) -> 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.
Expand All @@ -1520,6 +1522,10 @@ def addNPTHole(self, position: VECTOR2I, diameter: KiLength,
pad.SetLayerSet(layerSet)
if ref is not None:
footprint.SetReference(ref)
if hasattr(footprint, "SetExcludedFromPosFiles"): # KiCAD 6 doesn't support this attribute
footprint.SetExcludedFromPosFiles(excludedFromPos)
if hasattr(footprint, "SetBoardOnly"):
footprint.SetBoardOnly(True)
self.board.Add(footprint)

def addFiducial(self, position: VECTOR2I, copperDiameter: KiLength,
Expand Down Expand Up @@ -1590,7 +1596,7 @@ 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}")
self.addNPTHole(pos, diameter, paste, ref=f"KiKit_TO_{i+1}", excludedFromPos=False)

def addMillFillets(self, millRadius):
"""
Expand Down

0 comments on commit 8a54976

Please sign in to comment.