From 5020017cd70bf4fd1a20b4df8c58acd14d785c21 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 13 Apr 2019 17:26:03 +0300 Subject: [PATCH] - final fix for issue #277. Previous fix was applied only for one case out of three. - RELEASE 8.913 --- README.md | 1 + camlib.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30fd637c..f99f17da 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing. - Gerber Editor: added ability to change on the fly the aperture after one of the tools: Add Pad or Add Pad Array is activated - Gerber Editor: if a tool is cancelled via key shortcut ESCAPE, the selection is now deleted and any other action require a new selection - finished German translation (Google translated with some adjustments) +- final fix for issue #277. Previous fix was applied only for one case out of three. - RELEASE 8.913 12.04.2019 diff --git a/camlib.py b/camlib.py index c7f53d33..16eddd60 100644 --- a/camlib.py +++ b/camlib.py @@ -5321,7 +5321,13 @@ class CNCjob(Geometry): current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"])) else: current_tooldia = float('%.3f' % float(exobj.tools[tool]["C"])) - z_offset = float(self.tool_offset[current_tooldia]) * (-1) + + # TODO apply offset only when using the GUI, for TclCommand this will create an error + # because the values for Z offset are created in build_ui() + try: + z_offset = float(self.tool_offset[current_tooldia]) * (-1) + except KeyError: + z_offset = 0 self.z_cut += z_offset # Drillling! @@ -5467,8 +5473,15 @@ class CNCjob(Geometry): current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"])) else: current_tooldia = float('%.3f' % float(exobj.tools[tool]["C"])) - z_offset = float(self.tool_offset[current_tooldia]) * (-1) + + # TODO apply offset only when using the GUI, for TclCommand this will create an error + # because the values for Z offset are created in build_ui() + try: + z_offset = float(self.tool_offset[current_tooldia]) * (-1) + except KeyError: + z_offset = 0 self.z_cut += z_offset + # Drillling! altPoints = [] for point in points[tool]: