Skip to content

Commit 2649547

Browse files
committed
Merge tag 'v1.7.2'
Release v1.7.2
2 parents 6e22ef0 + 410ea3c commit 2649547

File tree

8 files changed

+54
-32
lines changed

8 files changed

+54
-32
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body:
99
required: true
1010
- label: I have searched existing issues (including closed ones)
1111
required: true
12-
- label: I use KiKit at least version 1.7.1 (older version are not supported)
12+
- label: I use KiKit at least version 1.7.2 (older version are not supported)
1313
required: true
1414
- type: input
1515
attributes:

kikit/defs.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class LayerV1(IntEnum):
6969
def allCu():
7070
return list(range(LayerV1.F_Cu, LayerV1.B_Cu + 1))
7171

72+
@staticmethod
73+
def innerCu(layerCount):
74+
return list(range(LayerV1.In1_Cu, LayerV1.In1_Cu + layerCount - 2))
75+
7276
@staticmethod
7377
def all():
7478
return list(range(LayerV1.F_Cu, LayerV1.User_4 + 1))
@@ -150,9 +154,19 @@ class LayerV2(IntEnum):
150154
def allCu():
151155
return list(range(LayerV2.F_Cu, LayerV2.In30_Cu + 2, 2))
152156

157+
@staticmethod
158+
def innerCu(layerCount):
159+
return list(range(LayerV2.In1_Cu, LayerV2.In1_Cu + (layerCount - 2) * 2, 2))
160+
153161
@staticmethod
154162
def all():
155-
return list(range(64))
163+
return (
164+
list(range(LayerV2.F_Cu, LayerV2.In30_Cu + 2, 2))
165+
+ list(range(LayerV2.F_Mask, LayerV2.B_Paste + 2, 2))
166+
+ list(range(LayerV2.Dwgs_User, LayerV2.Margin + 2, 2))
167+
+ list(range(LayerV2.B_CrtYd, LayerV2.F_Fab + 2, 2))
168+
+ list(range(LayerV2.User_1, LayerV2.User_9 + 2, 2))
169+
)
156170

157171
@staticmethod
158172
def allTech():

kikit/drc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def roundCoord(x: int) -> int:
2020
# emulate that
2121
return round(x - 50, -4)
2222

23-
def getItemDescription(item: pcbnew.BOARD_ITEM, units: pcbnew.EDA_UNITS = pcbnew.EDA_UNITS_MILLIMETRES):
23+
def getItemDescription(item: pcbnew.BOARD_ITEM, units: pcbnew.EDA_UNITS = pcbnew.EDA_UNITS_MM):
2424
if isV9():
2525
uProvider = pcbnew.UNITS_PROVIDER(pcbnew.pcbIUScale, units)
2626
return item.GetItemDescription(uProvider, True)
@@ -89,9 +89,9 @@ def format(self, units: Any) -> str:
8989
def _formatObject(self, obj: pcbnew.BOARD_ITEM, units: Any) -> str:
9090
p = obj.GetPosition()
9191
pos = "unknown"
92-
if units == pcbnew.EDA_UNITS_MILLIMETRES:
92+
if units == pcbnew.EDA_UNITS_MM:
9393
pos = f"{toMm(p[0]):.4f} mm, {toMm(p[1]):.4f} mm"
94-
if units == pcbnew.EDA_UNITS_INCHES:
94+
if units == pcbnew.EDA_UNITS_INCH:
9595
pos = f"{pcbnew.ToMils(p[0]):.1f} mil, {pcbnew.ToMils(p[1]):.1f} mil"
9696
return f"@({pos}): {getItemDescription(obj, units)}"
9797

@@ -200,7 +200,7 @@ def runBoardDrc(board: pcbnew.BOARD, strict: bool) -> DrcReport:
200200
try:
201201
tmpFile.close()
202202
result = pcbnew.WriteDRCReport(board, tmpFile.name,
203-
pcbnew.EDA_UNITS_MILLIMETRES, strict)
203+
pcbnew.EDA_UNITS_MM, strict)
204204
if not result:
205205
raise RuntimeError("Cannot run DRC: Unspecified KiCAD error")
206206
with open(tmpFile.name, encoding="utf-8") as f:
@@ -248,7 +248,7 @@ def runImpl(board, useMm, ignoreExcluded, strict, level, yieldViolation):
248248
import sys
249249
faulthandler.enable(sys.stderr)
250250

251-
units = pcbnew.EDA_UNITS_MILLIMETRES if useMm else EDA_UNITS_INCHES
251+
units = pcbnew.EDA_UNITS_MM if useMm else pcbnew.EDA_UNITS_INCH
252252
report = runBoardDrc(board, strict)
253253
if ignoreExcluded:
254254
report.pruneExclusions(readBoardDrcExclusions(board))

kikit/export.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
fullGerberPlotPlan = [
1010
# name, id, comment
11-
("CuTop", F_Cu, "Top layer"),
12-
("CuBottom", B_Cu, "Bottom layer"),
13-
("PasteBottom", B_Paste, "Paste Bottom"),
14-
("PasteTop", F_Paste, "Paste top"),
15-
("SilkTop", F_SilkS, "Silk top"),
16-
("SilkBottom", B_SilkS, "Silk top"),
17-
("MaskBottom", B_Mask, "Mask bottom"),
18-
("MaskTop", F_Mask, "Mask top"),
19-
("EdgeCuts", Edge_Cuts, "Edges"),
20-
("CmtUser", Cmts_User, "V-CUT")
11+
("CuTop", Layer.F_Cu, "Top layer"),
12+
("CuBottom", Layer.B_Cu, "Bottom layer"),
13+
("PasteBottom", Layer.B_Paste, "Paste Bottom"),
14+
("PasteTop", Layer.F_Paste, "Paste top"),
15+
("SilkTop", Layer.F_SilkS, "Silk top"),
16+
("SilkBottom", Layer.B_SilkS, "Silk top"),
17+
("MaskBottom", Layer.B_Mask, "Mask bottom"),
18+
("MaskTop", Layer.F_Mask, "Mask top"),
19+
("EdgeCuts", Layer.Edge_Cuts, "Edges"),
20+
("CmtUser", Layer.Cmts_User, "V-CUT")
2121
]
2222

2323
exportSettingsJlcpcb = {
@@ -57,7 +57,7 @@
5757

5858
def hasCopper(plotPlan):
5959
for _, layer, _ in plotPlan:
60-
if layer in [F_Cu, B_Cu]:
60+
if layer in [Layer.F_Cu, Layer.B_Cu]:
6161
return True
6262
return False
6363

@@ -123,19 +123,18 @@ def gerberImpl(boardfile, outputdir, plot_plan=fullGerberPlotPlan, drilling=True
123123
pctl.OpenPlotfile(suffix, PLOT_FORMAT_GERBER, comment)
124124
jobfile_writer.AddGbrFile(id, os.path.basename(pctl.GetPlotFileName()))
125125
if pctl.PlotLayer() == False:
126-
print("plot error")
126+
raise RuntimeError("KiCAD plot error")
127127

128128
if hasCopper(plot_plan):
129129
#generate internal copper layers, if any
130-
lyrcnt = board.GetCopperLayerCount()
131-
for innerlyr in range (1, lyrcnt - 1):
130+
for i, layer in enumerate(Layer.innerCu(board.GetCopperLayerCount())):
132131
popt.SetSkipPlotNPTH_Pads(True)
133-
pctl.SetLayer(innerlyr)
134-
lyrname = "" if settings["NoSuffix"] else 'inner{}'.format(innerlyr)
135-
pctl.OpenPlotfile(lyrname, PLOT_FORMAT_GERBER, "inner")
136-
jobfile_writer.AddGbrFile(innerlyr, os.path.basename(pctl.GetPlotFileName()))
132+
pctl.SetLayer(layer)
133+
layerName = "" if settings["NoSuffix"] else f"inner{i + 1}"
134+
pctl.OpenPlotfile(layerName, PLOT_FORMAT_GERBER, "inner")
135+
jobfile_writer.AddGbrFile(layer, os.path.basename(pctl.GetPlotFileName()))
137136
if pctl.PlotLayer() == False:
138-
print("plot error")
137+
raise RuntimeError("KiCAD plot error")
139138

140139
# At the end you have to close the last plot, otherwise you don't know when
141140
# the object will be recycled!
@@ -186,7 +185,7 @@ def pasteDxfExport(board, plotDir):
186185
popt.SetMirror(False)
187186
setExcludeEdgeLayer(popt, True)
188187
popt.SetScale(1)
189-
popt.SetDXFPlotUnits(DXF_UNITS_MILLIMETERS)
188+
popt.SetDXFPlotUnits(DXF_UNITS_MM)
190189
popt.SetDXFPlotPolygonMode(False)
191190
popt.SetDrillMarksType(DRILL_MARKS_NO_DRILL_SHAPE)
192191

kikit/panelize.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ def __init__(self, panelFilename):
490490
"""
491491
self.errors: List[Tuple[KiPoint, str]] = []
492492

493+
if not panelFilename.endswith(".kicad_pcb"):
494+
raise PanelError("Panel filename has to have .kicad_pcb suffix")
495+
493496
self.filename = panelFilename
494497
self.board = pcbnew.NewBoard(panelFilename)
495498
self.sourcePaths = set() # A set of all board files that were appended to the panel
@@ -1645,6 +1648,8 @@ def addNPTHole(self, position: VECTOR2I, diameter: KiLength,
16451648
footprint.SetReference(ref)
16461649
if hasattr(footprint, "SetExcludedFromPosFiles"): # KiCAD 6 doesn't support this attribute
16471650
footprint.SetExcludedFromPosFiles(excludedFromPos)
1651+
if hasattr(footprint, "SetExcludedFromBOM"):
1652+
footprint.SetExcludedFromBOM(True)
16481653
if hasattr(footprint, "SetBoardOnly"):
16491654
footprint.SetBoardOnly(True)
16501655
self.board.Add(footprint)
@@ -1666,6 +1671,10 @@ def addFiducial(self, position: VECTOR2I, copperDiameter: KiLength,
16661671
self.board.Add(footprint)
16671672
if ref is not None:
16681673
footprint.SetReference(ref)
1674+
if hasattr(footprint, "SetExcludedFromBOM"):
1675+
footprint.SetExcludedFromBOM(True)
1676+
if hasattr(footprint, "SetBoardOnly"):
1677+
footprint.SetBoardOnly(True)
16691678
for pad in footprint.Pads():
16701679
pad.SetSize(toKiCADPoint((copperDiameter, copperDiameter)))
16711680
pad.SetLocalSolderMaskMargin(int((openingDiameter - copperDiameter) / 2))
@@ -2345,7 +2354,7 @@ def addPanelDimensions(self, layer: Layer, offset: KiLength) -> None:
23452354
hDim.SetStart(toKiCADPoint((minx, miny)))
23462355
hDim.SetEnd(toKiCADPoint((maxx, miny)))
23472356
hDim.SetLayer(layer)
2348-
hDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MILLIMETRES)
2357+
hDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MM)
23492358
hDim.SetSuppressZeroes(True)
23502359
if self.chamferHeight is not None:
23512360
hDim.SetExtensionOffset(-self.chamferHeight)
@@ -2359,7 +2368,7 @@ def addPanelDimensions(self, layer: Layer, offset: KiLength) -> None:
23592368
vDim.SetStart(toKiCADPoint((minx, miny)))
23602369
vDim.SetEnd(toKiCADPoint((minx, maxy)))
23612370
vDim.SetLayer(layer)
2362-
vDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MILLIMETRES)
2371+
vDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MM)
23632372
vDim.SetSuppressZeroes(True)
23642373
if self.chamferWidth is not None:
23652374
vDim.SetExtensionOffset(-self.chamferWidth)

pcm/kikit-lib/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"versions": [
2929
{
30-
"version": "1.7.1",
30+
"version": "1.7.2",
3131
"status": "stable",
3232
"kicad_version": "8.0"
3333
}

pcm/kikit/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"versions": [
2929
{
30-
"version": "1.7.1",
30+
"version": "1.7.2",
3131
"status": "stable",
3232
"kicad_version": "8.0"
3333
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
],
5959
install_requires=[
6060
"numpy",
61-
"pcbnewTransition >= 0.5.0, <=0.6",
61+
"pcbnewTransition >= 0.5.2, <=0.6",
6262
"shapely>=2.0.3",
6363
"click>=7.1",
6464
"markdown2>=2.3",

0 commit comments

Comments
 (0)