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

This commit is contained in:
Marius Stanciu
2019-09-17 02:58:01 +03:00
committed by Marius
parent bd0c1da007
commit fe97364ba5
4 changed files with 21 additions and 13 deletions

View File

@@ -12,8 +12,9 @@ CAD program, and create G-Code for Isolation routing.
17.09.2019 17.09.2019
- added more programmers that contributed to FlatCAM over the years, in the "About FlatCAM" -> Programmers window - 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 - 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 16.09.2019

View File

@@ -101,13 +101,13 @@ class TclCommandCncjob(TclCommandSignaled):
obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False) obj = self.app.collection.get_by_name(str(name), isCaseSensitive=False)
if obj is None: if obj is None:
if not muted: if muted == 0:
self.raise_tcl_error("Object not found: %s" % str(name)) self.raise_tcl_error("Object not found: %s" % str(name))
else: else:
return return "fail"
if not isinstance(obj, FlatCAMGeometry): if not isinstance(obj, FlatCAMGeometry):
if not muted: if muted == 0:
self.raise_tcl_error('Expected FlatCAMGeometry, got %s %s.' % (str(name), type(obj))) self.raise_tcl_error('Expected FlatCAMGeometry, got %s %s.' % (str(name), type(obj)))
else: else:
return return
@@ -153,7 +153,7 @@ class TclCommandCncjob(TclCommandSignaled):
else: else:
if args[arg] is None: if args[arg] is None:
print(arg, args[arg]) 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' 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' '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.') 'generated by the TclCommand "list_sys geom". or in the arguments.')

View File

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

View File

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