From da7029dc0b145efc918f5936b5941eb108e8c90f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 9 Feb 2019 01:18:03 +0200 Subject: [PATCH] - if trying to add a tool using shortcut key 'T' with value zero the app will react with a message telling to use a non-zero value. --- FlatCAMApp.py | 20 +++++++++++++------- FlatCAMGUI.py | 2 +- README.md | 1 + flatcamTools/ToolNonCopperClear.py | 7 +++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 1e52ff7d..d2e5d916 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -93,7 +93,7 @@ class App(QtCore.QObject): # Version version = 8.908 - version_date = "2019/02/7" + version_date = "2019/02/9" beta = True # current date now @@ -2753,9 +2753,11 @@ class App(QtCore.QObject): val, ok = tool_add_popup.get_value() if ok: + if float(val) == 0: + self.inform.emit( + "[WARNING_NOTCL] Please enter a tool diameter with non-zero value, in Float format.") + return self.collection.get_active().on_tool_add(dia=float(val)) - self.inform.emit( - "[success]Added new tool with dia: %s %s" % ('%.4f' % float(val), str(self.units))) else: self.inform.emit( "[WARNING_NOTCL] Adding Tool cancelled ...") @@ -2771,9 +2773,11 @@ class App(QtCore.QObject): val, ok = tool_add_popup.get_value() if ok: + if float(val) == 0: + self.inform.emit( + "[WARNING_NOTCL] Please enter a tool diameter with non-zero value, in Float format.") + return self.ncclear_tool.on_tool_add(dia=float(val)) - self.inform.emit( - "[success]Added new tool with dia: %s %s" % ('%.4f' % float(val), str(self.units))) else: self.inform.emit( "[WARNING_NOTCL] Adding Tool cancelled ...") @@ -2786,9 +2790,11 @@ class App(QtCore.QObject): val, ok = tool_add_popup.get_value() if ok: + if float(val) == 0: + self.inform.emit( + "[WARNING_NOTCL] Please enter a tool diameter with non-zero value, in Float format.") + return self.paint_tool.on_tool_add(dia=float(val)) - self.inform.emit( - "[success]Added new tool with dia: %s %s" % ('%.4f' % float(val), str(self.units))) else: self.inform.emit( "[WARNING_NOTCL] Adding Tool cancelled ...") diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index 848d883b..ec23266e 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -831,7 +831,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): T -  Add a Tool (when in Geometry Selected Tab) +  Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint) V diff --git a/README.md b/README.md index 7e15236b..415e7899 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ CAD program, and create G-Code for Isolation routing. - fixed bug in Geometry Selected tab that generated error when used tool offset was less than half of either total length or half of total width. Now the app signal the issue with a status bar message - added Double Validator for the Offset value so only float numbers can be entered. - in App added a shortcut key 'T' that popup a windows allowing to enter a new Tool with set diameter only when the Tool tab is on focus and only if a NCC Tool or Paint Area Tool object is installed in the Tool Tab +- if trying to add a tool using shortcut key 'T' with value zero the app will react with a message telling to use a non-zero value. 7.02.2019 diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index 020fd314..e8f7f041 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -447,6 +447,10 @@ class NonCopperClear(FlatCAMTool, Gerber): self.app.inform.emit("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format.") return + if tool_dia == 0: + self.app.inform.emit("[WARNING_NOTCL] Please enter a tool diameter with non-zero value, in Float format.") + return + # construct a list of all 'tooluid' in the self.tools tool_uid_list = [] for tooluid_key in self.ncc_tools: @@ -619,7 +623,6 @@ class NonCopperClear(FlatCAMTool, Gerber): self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % self.obj_name) return "Could not retrieve object: %s" % self.obj_name - # Prepare non-copper polygons try: bounding_box = self.ncc_obj.solid_geometry.envelope.buffer(distance=margin, join_style=JOIN_STYLE.mitre) @@ -627,7 +630,7 @@ class NonCopperClear(FlatCAMTool, Gerber): self.app.inform.emit("[ERROR_NOTCL]No Gerber file available.") return - # calculate the empty area by substracting the solid_geometry from the object bounding box geometry + # calculate the empty area by subtracting the solid_geometry from the object bounding box geometry empty = self.ncc_obj.get_empty_area(bounding_box) if type(empty) is Polygon: empty = MultiPolygon([empty])