Skip to content

Commit 5df22f7

Browse files
authored
Merge pull request #5 from sparkfun/release_candidate
v1.1.1 - compatible with KiCad 7 and 8
2 parents 9309709 + 9bf8146 commit 5df22f7

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# SparkFun PCB BOM Generator plugin for KiCad 7
1+
# SparkFun PCB BOM Generator plugin for KiCad 7 / 8
22

3-
This plugin generates the Bill Of Materials (BOM) for a KiCad 7 PCB.
3+
This plugin generates the Bill Of Materials (BOM) for a KiCad 7 / 8 PCB.
44

55
![BOM Generator](./img/bom_generator.png)
66

SparkFunKiCadBOMGenerator/plugin.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self):
3636

3737
self._pcbnew_frame = None
3838

39-
self.kicad_build_version = pcbnew.GetBuildVersion()
39+
self.baseVersion = pcbnew.GetBuildVersion().split('.')[0] # Use GetBuildVersion. GetBaseVersion is only available in KiCad 8
4040

4141
def Run(self):
4242
if self._pcbnew_frame is None:
@@ -77,9 +77,15 @@ def Run(self):
7777
name = name.split(":")[1]
7878
prod_id = ""
7979
hasProdID = False
80-
if sourceModule.HasFieldByName("PROD_ID"): # Breaking change for KiCad 8
81-
prod_id = sourceModule.GetFieldText("PROD_ID") # Breaking change for KiCad 8
82-
hasProdID = True
80+
if self.baseVersion < '8':
81+
if hasattr(sourceModule, "HasProperty"):
82+
if sourceModule.HasProperty("PROD_ID"):
83+
prod_id = sourceModule.GetPropertyNative("PROD_ID")
84+
hasProdID = True
85+
else:
86+
if sourceModule.HasFieldByName("PROD_ID"): # Breaking change for KiCad 8
87+
prod_id = sourceModule.GetFieldText("PROD_ID") # Breaking change for KiCad 8
88+
hasProdID = True
8389
if hasProdID:
8490
if prod_id == "":
8591
prod_id = ">> EMPTY <<"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.0"
1+
__version__ = "1.1.1"

0 commit comments

Comments
 (0)