Просмотр исходного кода

- 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.

Marius Stanciu 7 лет назад
Родитель
Сommit
da7029dc0b
4 измененных файлов с 20 добавлено и 10 удалено
  1. 13 7
      FlatCAMApp.py
  2. 1 1
      FlatCAMGUI.py
  3. 1 0
      README.md
  4. 5 2
      flatcamTools/ToolNonCopperClear.py

+ 13 - 7
FlatCAMApp.py

@@ -93,7 +93,7 @@ class App(QtCore.QObject):
 
 
     # Version
     # Version
     version = 8.908
     version = 8.908
-    version_date = "2019/02/7"
+    version_date = "2019/02/9"
     beta = True
     beta = True
 
 
     # current date now
     # current date now
@@ -2753,9 +2753,11 @@ class App(QtCore.QObject):
 
 
                 val, ok = tool_add_popup.get_value()
                 val, ok = tool_add_popup.get_value()
                 if ok:
                 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.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:
                 else:
                     self.inform.emit(
                     self.inform.emit(
                         "[WARNING_NOTCL] Adding Tool cancelled ...")
                         "[WARNING_NOTCL] Adding Tool cancelled ...")
@@ -2771,9 +2773,11 @@ class App(QtCore.QObject):
 
 
                 val, ok = tool_add_popup.get_value()
                 val, ok = tool_add_popup.get_value()
                 if ok:
                 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.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:
                 else:
                     self.inform.emit(
                     self.inform.emit(
                         "[WARNING_NOTCL] Adding Tool cancelled ...")
                         "[WARNING_NOTCL] Adding Tool cancelled ...")
@@ -2786,9 +2790,11 @@ class App(QtCore.QObject):
 
 
                 val, ok = tool_add_popup.get_value()
                 val, ok = tool_add_popup.get_value()
                 if ok:
                 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.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:
                 else:
                     self.inform.emit(
                     self.inform.emit(
                         "[WARNING_NOTCL] Adding Tool cancelled ...")
                         "[WARNING_NOTCL] Adding Tool cancelled ...")

+ 1 - 1
FlatCAMGUI.py

@@ -831,7 +831,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 		</tr>
 		</tr>
         <tr height="20">
         <tr height="20">
 			<td height="20"><strong>T</strong></td>
 			<td height="20"><strong>T</strong></td>
-			<td>&nbsp;Add a Tool (when in Geometry Selected Tab)</td>
+			<td>&nbsp;Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)</td>
 		</tr>
 		</tr>
 		<tr height="20">
 		<tr height="20">
 			<td height="20"><strong>V</strong></td>
 			<td height="20"><strong>V</strong></td>

+ 1 - 0
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
 - 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.
 - 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
 - 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
 7.02.2019
 
 

+ 5 - 2
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.")
                 self.app.inform.emit("[WARNING_NOTCL] Please enter a tool diameter to add, in Float format.")
                 return
                 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
         # construct a list of all 'tooluid' in the self.tools
         tool_uid_list = []
         tool_uid_list = []
         for tooluid_key in self.ncc_tools:
         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)
             self.app.inform.emit("[ERROR_NOTCL]Could not retrieve object: %s" % self.obj_name)
             return "Could not retrieve object: %s" % self.obj_name
             return "Could not retrieve object: %s" % self.obj_name
 
 
-
         # Prepare non-copper polygons
         # Prepare non-copper polygons
         try:
         try:
             bounding_box = self.ncc_obj.solid_geometry.envelope.buffer(distance=margin, join_style=JOIN_STYLE.mitre)
             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.")
             self.app.inform.emit("[ERROR_NOTCL]No Gerber file available.")
             return
             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)
         empty = self.ncc_obj.get_empty_area(bounding_box)
         if type(empty) is Polygon:
         if type(empty) is Polygon:
             empty = MultiPolygon([empty])
             empty = MultiPolygon([empty])