فهرست منبع

- fixed issue #313 where TclCommand drillcncjob is spitting errors in Tcl Shell which should be ignored

Marius Stanciu 6 سال پیش
والد
کامیت
fe97364ba5
4فایلهای تغییر یافته به همراه21 افزوده شده و 13 حذف شده
  1. 2 1
      README.md
  2. 4 4
      tclCommands/TclCommandCncjob.py
  3. 13 6
      tclCommands/TclCommandDrillcncjob.py
  4. 2 2
      tclCommands/TclCommandWriteGCode.py

+ 2 - 1
README.md

@@ -12,8 +12,9 @@ CAD program, and create G-Code for Isolation routing.
 17.09.2019
 
 - added more programmers that contributed to FlatCAM over the years, in the "About FlatCAM" -> Programmers window
-- fixed #315 where a script run with the --shellfile argument crashed the program if it contained a TclCommand New
+- fixed issue #315 where a script run with the --shellfile argument crashed the program if it contained a TclCommand New
 - added messages in the Splash Screen when running FlatCAM with arguments at startup
+- fixed issue #313 where TclCommand drillcncjob is spitting errors in Tcl Shell which should be ignored
 
 16.09.2019
 

+ 4 - 4
tclCommands/TclCommandCncjob.py

@@ -101,13 +101,13 @@ class TclCommandCncjob(TclCommandSignaled):
         obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False)
 
         if obj is None:
-            if not muted:
+            if muted == 0:
                 self.raise_tcl_error("Object not found: %s" % str(name))
             else:
-                return
+                return "fail"
 
         if not isinstance(obj, FlatCAMGeometry):
-            if not muted:
+            if muted == 0:
                 self.raise_tcl_error('Expected FlatCAMGeometry, got %s %s.' % (str(name), type(obj)))
             else:
                 return
@@ -153,7 +153,7 @@ class TclCommandCncjob(TclCommandSignaled):
             else:
                 if args[arg] is None:
                     print(arg, args[arg])
-                    if not muted:
+                    if muted == 0:
                         self.raise_tcl_error('One of the command parameters that have to be not None, is None.\n'
                                              'The parameter that is None is in the default values found in the list \n'
                                              'generated by the TclCommand "list_sys geom". or in the arguments.')

+ 13 - 6
tclCommands/TclCommandDrillcncjob.py

@@ -92,13 +92,16 @@ class TclCommandDrillcncjob(TclCommandSignaled):
 
         obj = self.app.collection.get_by_name(name)
         if obj is None:
-            self.raise_tcl_error("Object not found: %s" % name)
+            if muted == 0:
+                self.raise_tcl_error("Object not found: %s" % name)
+            else:
+                return "fail"
 
         if not isinstance(obj, FlatCAMExcellon):
-            if not muted:
+            if muted == 0:
                 self.raise_tcl_error('Expected FlatCAMExcellon, got %s %s.' % (name, type(obj)))
             else:
-                return
+                return "fail"
 
         xmin = obj.options['xmin']
         ymin = obj.options['ymin']
@@ -136,11 +139,11 @@ class TclCommandDrillcncjob(TclCommandSignaled):
                                     nr_diameters -= 1
 
                     if nr_diameters > 0:
-                        if not muted:
+                        if muted == 0:
                             self.raise_tcl_error("One or more tool diameters of the drills to be drilled passed to the "
                                                  "TclCommand are not actual tool diameters in the Excellon object.")
                         else:
-                            return
+                            return "fail"
 
                     # make a string of diameters separated by comma; this is what generate_from_excellon_by_tool() is
                     # expecting as tools parameter
@@ -156,7 +159,11 @@ class TclCommandDrillcncjob(TclCommandSignaled):
                     tools = 'all'
             except Exception as e:
                 tools = 'all'
-                self.raise_tcl_error("Bad tools: %s" % str(e))
+
+                if muted == 0:
+                    self.raise_tcl_error("Bad tools: %s" % str(e))
+                else:
+                    return "fail"
 
             drillz = args["drillz"] if "drillz" in args and args["drillz"] else obj.options["drillz"]
             toolchangez = args["toolchangez"] if "toolchangez" in args and args["toolchangez"] else \

+ 2 - 2
tclCommands/TclCommandWriteGCode.py

@@ -90,10 +90,10 @@ class TclCommandWriteGCode(TclCommandSignaled):
         try:
             obj = self.app.collection.get_by_name(str(obj_name))
         except:
-            if not muted:
+            if muted == 0:
                 return "Could not retrieve object: %s" % obj_name
             else:
-                return
+                return "fail"
 
         try:
             obj.export_gcode(str(filename), str(preamble), str(postamble))