summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-03-31 22:34:28 +0200
committerjaseg <git@jaseg.de>2023-04-10 23:57:15 +0200
commitdcb31f313147e471a8a225e964e61296f52096b2 (patch)
tree630741ae23be0c8155a43624606162af59581adb
parent33a35f796d1efa5233adb3da7483b198f13cb375 (diff)
downloadgerbonara-dcb31f313147e471a8a225e964e61296f52096b2.tar.gz
gerbonara-dcb31f313147e471a8a225e964e61296f52096b2.tar.bz2
gerbonara-dcb31f313147e471a8a225e964e61296f52096b2.zip
Fix extraneous tool selection codes in merged Excellon files
-rwxr-xr-xgerbonara/excellon.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/gerbonara/excellon.py b/gerbonara/excellon.py
index 1ce9c64..d395ecf 100755
--- a/gerbonara/excellon.py
+++ b/gerbonara/excellon.py
@@ -46,13 +46,15 @@ class ExcellonContext:
def select_tool(self, tool):
""" Select the current tool. Retract drill first if necessary. """
- if self.current_tool != tool:
+ current_id = self.tools.get(id(self.current_tool))
+ new_id = self.tools[id(tool)]
+ if new_id != current_id:
if self.drill_down:
yield 'M16' # drill up
self.drill_down = False
self.current_tool = tool
- yield f'T{self.tools[id(tool)]:02d}'
+ yield f'T{new_id:02d}'
def drill_mode(self):
""" Enter drill mode. """