Skip to content

Commit db7a129

Browse files
committed
Detect version of KiCad by parsing number
1 parent 33d092a commit db7a129

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugins/gerber_to_order_action.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
retryCount = 10
1717
retryWaitSecond = 0.1
1818

19-
isKiCad_7_0 = re.match(r'^7\.0\..*', pcbnew.Version())
20-
isKiCad_7_0_orMore = isKiCad_7_0 is not None
19+
versionRegrepResult = re.compile("^([0-9]*)\.([0-9]*)\..*").match(pcbnew.Version())
20+
versionMajor = int(versionRegrepResult.group(1))
21+
# versionMinor = int(versionRegrepResult.group(2))
22+
isKiCad_7_orMore = versionMajor >= 7
2123

2224
layers = [
2325
[ pcbnew.F_Cu, 'F_Cu' ],
@@ -233,7 +235,7 @@ def plotDrill(
233235
):
234236
ew = pcbnew.EXCELLON_WRITER(board)
235237
ew.SetFormat(True, excellonFormat, 3, 3)
236-
offset = pcbnew.VECTOR2I(0,0) if isKiCad_7_0_orMore else pcbnew.wxPoint(0,0)
238+
offset = pcbnew.VECTOR2I(0,0) if isKiCad_7_orMore else pcbnew.wxPoint(0,0)
237239
if useAuxOrigin:
238240
if hasattr(board, "GetAuxOrigin"):
239241
offset = board.GetAuxOrigin()

0 commit comments

Comments
 (0)