From dcb31f313147e471a8a225e964e61296f52096b2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 31 Mar 2023 22:34:28 +0200 Subject: Fix extraneous tool selection codes in merged Excellon files --- gerbonara/excellon.py | 6 ++++-- 1 file 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. """ -- cgit