Skip to content

Commit 9d43752

Browse files
committed
Adapt to renamed units in the API
1 parent 52efdcc commit 9d43752

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.github/workflows/test-kikit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
14-
kicad-version: [v8, v9]
14+
kicad-version: [v8, v9, v9-testing]
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: ./.github/actions/setup-kicad

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def pasteDxfExport(board, plotDir):
185185
popt.SetMirror(False)
186186
setExcludeEdgeLayer(popt, True)
187187
popt.SetScale(1)
188-
popt.SetDXFPlotUnits(DXF_UNITS_MILLIMETERS)
188+
popt.SetDXFPlotUnits(DXF_UNITS_MM)
189189
popt.SetDXFPlotPolygonMode(False)
190190
popt.SetDrillMarksType(DRILL_MARKS_NO_DRILL_SHAPE)
191191

kikit/panelize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ def addPanelDimensions(self, layer: Layer, offset: KiLength) -> None:
23542354
hDim.SetStart(toKiCADPoint((minx, miny)))
23552355
hDim.SetEnd(toKiCADPoint((maxx, miny)))
23562356
hDim.SetLayer(layer)
2357-
hDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MILLIMETRES)
2357+
hDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MM)
23582358
hDim.SetSuppressZeroes(True)
23592359
if self.chamferHeight is not None:
23602360
hDim.SetExtensionOffset(-self.chamferHeight)
@@ -2368,7 +2368,7 @@ def addPanelDimensions(self, layer: Layer, offset: KiLength) -> None:
23682368
vDim.SetStart(toKiCADPoint((minx, miny)))
23692369
vDim.SetEnd(toKiCADPoint((minx, maxy)))
23702370
vDim.SetLayer(layer)
2371-
vDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MILLIMETRES)
2371+
vDim.SetUnitsMode(pcbnew.DIM_UNITS_MODE_MM)
23722372
vDim.SetSuppressZeroes(True)
23732373
if self.chamferWidth is not None:
23742374
vDim.SetExtensionOffset(-self.chamferWidth)

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", # Required for MacOS
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.4",

0 commit comments

Comments
 (0)