Skip to content

Commit

Permalink
Fix breaking API change in V7.99 nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouni committed Jul 17, 2023
1 parent beb6d7b commit 6f34695
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,16 @@ def alphanum_key(key):

def get_lcsc_value(fp):
"""Get the first lcsc number (C123456 for example) from the properties of the footprint."""
for value in fp.GetProperties().values():
if re.match(r"^C\d+$", value):
return value
# Kicad 7.99
try:
for field in fp.GetFields():
if re.match(r"^C\d+$", field.GetText()):
return field.GetText()
# KiCad < V7
except AttributeError:
for value in fp.GetProperties().values():
if re.match(r"^C\d+$", value):
return value
return ""


Expand Down

0 comments on commit 6f34695

Please sign in to comment.