Преглед изворни кода

- added a fix to allow creating of Excellon geometry even when there are points with no tools by skipping those points and warning the user about this in a Tcl message

Marius Stanciu пре 7 година
родитељ
комит
37067b5bff
3 измењених фајлова са 20 додато и 4 уклоњено
  1. 6 3
      FlatCAMApp.py
  2. 4 0
      README.md
  3. 10 1
      camlib.py

+ 6 - 3
FlatCAMApp.py

@@ -88,8 +88,8 @@ class App(QtCore.QObject):
 
     # Version
     version = 8.901
-    version_date = "2019/01/08"
-    beta = False
+    version_date = "2019/01/09"
+    beta = True
 
     # URL for update checks and statistics
     version_url = "http://flatcam.org/version"
@@ -1907,6 +1907,7 @@ class App(QtCore.QObject):
         self.log.debug("%f seconds executing initialize()." % (t2 - t1))
 
         if return_value == 'fail':
+            log.debug("Object (%s) parsing and/or geometry creation failed." % kind)
             return "fail"
 
         # Check units and convert if necessary
@@ -5118,13 +5119,14 @@ class App(QtCore.QObject):
             try:
                 ret = excellon_obj.parse_file(filename)
                 if ret == "fail":
+                    log.debug("Excellon parsing failed.")
                     self.inform.emit("[error_notcl] This is not Excellon file.")
                     return "fail"
             except IOError:
                 app_obj.inform.emit("[error_notcl] Cannot open file: " + filename)
+                log.debug("Could not open Excellon object.")
                 self.progress.emit(0)  # TODO: self and app_bjj mixed
                 return "fail"
-
             except:
                 msg = "[error_notcl] An internal error has occurred. See shell.\n"
                 msg += traceback.format_exc()
@@ -5133,6 +5135,7 @@ class App(QtCore.QObject):
 
             ret = excellon_obj.create_geometry()
             if ret == 'fail':
+                log.debug("Could not create geometry for Excellon object.")
                 return "fail"
 
             if excellon_obj.is_empty():

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+9.01.2019
+
+- added a fix to allow creating of Excellon geometry even when there are points with no tools by skipping those points and warning the user about this in a Tcl message
+
 8.01.2019
 
 - added checkboxes in Preferences -> General -> Global Preferences to switch on/off version check at application startup and also to control if the app will send anonymous statistics about FlatCAM usage to help improve FlatCAM

+ 10 - 1
camlib.py

@@ -4021,6 +4021,13 @@ class Excellon(Geometry):
         try:
             for drill in self.drills:
                 # poly = drill['point'].buffer(self.tools[drill['tool']]["C"]/2.0)
+                if drill['tool'] is '':
+                    self.app.inform.emit("[warning] Excellon.create_geometry() -> a drill location was skipped "
+                                         "due of not having a tool associated.\n"
+                                         "Check the resulting GCode.")
+                    log.debug("Excellon.create_geometry() -> a drill location was skipped "
+                              "due of not having a tool associated")
+                    continue
                 tooldia = self.tools[drill['tool']]['C']
                 poly = drill['point'].buffer(tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
                 self.solid_geometry.append(poly)
@@ -4033,8 +4040,10 @@ class Excellon(Geometry):
                 lines_string = LineString([start, stop])
                 poly = lines_string.buffer(slot_tooldia / 2.0, int(int(self.geo_steps_per_circle) / 4))
                 self.solid_geometry.append(poly)
-        except:
+        except Exception as e:
+            log.debug("Excellon geometry creation failed due of ERROR: %s" % str(e))
             return "fail"
+
         # drill_geometry = {}
         # slot_geometry = {}
         #