Skip to content

Commit

Permalink
Hooks up the property name setting to the schematic export.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalop committed Aug 2, 2024
1 parent d2065bc commit f79c98b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ def populate_footprint_list(self, *_):
part["type"] = details["type"]
part["stock"] = details["stock"]
part["description"] = details["description"]
# First check if the part name matches
for regex, correction in corrections:
if re.search(regex, str(part["reference"])):
part["rotation"] = str(correction)
Expand Down
5 changes: 3 additions & 2 deletions schematicexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _update_schematic8(self, path):
lastLcsc = ""
newLcsc = ""
lastRef = ""
property_name = self.parent.settings.get("schematic", {}).get("property_name", "LCSC")

lines = []
newlines = []
Expand Down Expand Up @@ -254,7 +255,7 @@ def _update_schematic8(self, path):
if m3 and partSection:
if lastLcsc == "" and newLcsc != "" and lastLoc != "":
self.logger.info("added %s to %s", newLcsc, lastRef)
newTxt = f'\t\t(property "LCSC" "{newLcsc}"\n\t\t\t(at {lastLoc} 0)'
newTxt = f'\t\t(property "{property_name}" "{newLcsc}"\n\t\t\t(at {lastLoc} 0)'
newlines.append(newTxt)
newlines.append(
"\t\t\t(effects\n\t\t\t\t(font\n\t\t\t\t\t(size 1.27 1.27)\n\t\t\t\t)\n\t\t\t\t(hide yes)"
Expand All @@ -273,4 +274,4 @@ def _update_schematic8(self, path):
with open(path, "w", encoding="utf-8") as f:
for line in newlines:
f.write(line + "\n")
self.logger.info("Added LCSC's to %s (maybe?)", path)
self.logger.info("Added \"%s\"'s to %s (maybe?)", property_name, path)

0 comments on commit f79c98b

Please sign in to comment.