@@ -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 ))
0 commit comments