From fe97364ba53fa90e733df2751aa6f07243bbf71d Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 17 Sep 2019 02:58:01 +0300 Subject: [PATCH] - fixed issue #313 where TclCommand drillcncjob is spitting errors in Tcl Shell which should be ignored --- README.md | 3 ++- tclCommands/TclCommandCncjob.py | 8 ++++---- tclCommands/TclCommandDrillcncjob.py | 19 +++++++++++++------ tclCommands/TclCommandWriteGCode.py | 4 ++-- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1ccbe71c..6c71d4ce 100644 --- a/README.md +++ b/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 diff --git a/tclCommands/TclCommandCncjob.py b/tclCommands/TclCommandCncjob.py index 5d561f8d..28deb94b 100644 --- a/tclCommands/TclCommandCncjob.py +++ b/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.') diff --git a/tclCommands/TclCommandDrillcncjob.py b/tclCommands/TclCommandDrillcncjob.py index f0719940..d50d0008 100644 --- a/tclCommands/TclCommandDrillcncjob.py +++ b/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 \ diff --git a/tclCommands/TclCommandWriteGCode.py b/tclCommands/TclCommandWriteGCode.py index b27fb44e..d849f4d4 100644 --- a/tclCommands/TclCommandWriteGCode.py +++ b/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))