From 00d331a775da0e9d505982157bf4e268bf8582cd Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 7 Dec 2019 01:27:49 +0200 Subject: [PATCH] - updated the CNCJob and Drillcncjob Tcl Commands to use 0 and 1 as values for the parameters that are stated as of bool type, beside the normal keywords of False and True --- README.md | 1 + tclCommands/TclCommandCncjob.py | 7 +++---- tclCommands/TclCommandDrillcncjob.py | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8e18f62e..3e1b930e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing. - renamed Calibrate Excellon Tool to a simpler Calibrate Tool - Calibrate Tool - when generating verification GCode it will always load into an Editor from which it can be edited and/or saved. On save the editor will close. +- updated the CNCJob and Drillcncjob Tcl Commands to use 0 and 1 as values for the parameters that are stated as of bool type, beside the normal keywords of False and True 6.12.2019 diff --git a/tclCommands/TclCommandCncjob.py b/tclCommands/TclCommandCncjob.py index 35600039..33cb023f 100644 --- a/tclCommands/TclCommandCncjob.py +++ b/tclCommands/TclCommandCncjob.py @@ -134,9 +134,8 @@ class TclCommandCncjob(TclCommandSignaled): args["feedrate_rapid"] = args["feedrate_rapid"] if "feedrate_rapid" in args and args["feedrate_rapid"] else \ obj.options["feedrate_rapid"] - args["multidepth"] = args["multidepth"] if "multidepth" in args and args["multidepth"] else \ - obj.options["multidepth"] - args["extracut"] = args["extracut"] if "extracut" in args and args["extracut"] else obj.options["extracut"] + args["multidepth"] = bool(args["multidepth"]) if "multidepth" in args else obj.options["multidepth"] + args["extracut"] = bool(args["extracut"]) if "extracut" in args else obj.options["extracut"] args["depthperpass"] = args["depthperpass"] if "depthperpass" in args and args["depthperpass"] else \ obj.options["depthperpass"] @@ -145,7 +144,7 @@ class TclCommandCncjob(TclCommandSignaled): args["endz"] = args["endz"] if "endz" in args and args["endz"] else obj.options["endz"] args["spindlespeed"] = args["spindlespeed"] if "spindlespeed" in args and args["spindlespeed"] else None - args["dwell"] = args["dwell"] if "dwell" in args and args["dwell"] else obj.options["dwell"] + args["dwell"] = bool(args["dwell"]) if "dwell" in args else obj.options["dwell"] args["dwelltime"] = args["dwelltime"] if "dwelltime" in args and args["dwelltime"] else obj.options["dwelltime"] args["pp"] = args["pp"] if "pp" in args and args["pp"] else obj.options["ppname_g"] diff --git a/tclCommands/TclCommandDrillcncjob.py b/tclCommands/TclCommandDrillcncjob.py index ed1bb315..2de0642a 100644 --- a/tclCommands/TclCommandDrillcncjob.py +++ b/tclCommands/TclCommandDrillcncjob.py @@ -90,19 +90,20 @@ class TclCommandDrillcncjob(TclCommandSignaled): name = args['name'] obj = self.app.collection.get_by_name(name) - if obj is None: - if muted == 0: - self.raise_tcl_error("Object not found: %s" % name) - else: - return "fail" if 'outname' not in args: args['outname'] = name + "_cnc" if 'muted' in args: - muted = args['muted'] + muted = bool(args['muted']) else: - muted = 0 + muted = False + + if obj is None: + if muted is False: + self.raise_tcl_error("Object not found: %s" % name) + else: + return "fail" if not isinstance(obj, FlatCAMExcellon): if muted == 0: @@ -174,7 +175,7 @@ class TclCommandDrillcncjob(TclCommandSignaled): toolchangez = args["toolchangez"] if "toolchangez" in args and args["toolchangez"] else \ obj.options["toolchangez"] endz = args["endz"] if "endz" in args and args["endz"] else obj.options["endz"] - toolchange = True if "toolchange" in args and args["toolchange"] == 1 else False + toolchange = True if "toolchange" in args and bool(args["toolchange"]) is True else False opt_type = args["opt_type"] if "opt_type" in args and args["opt_type"] else 'B' job_obj.z_move = args["travelz"] if "travelz" in args and args["travelz"] else obj.options["travelz"] @@ -182,7 +183,7 @@ class TclCommandDrillcncjob(TclCommandSignaled): job_obj.feedrate_rapid = args["feedrate_rapid"] \ if "feedrate_rapid" in args and args["feedrate_rapid"] else obj.options["feedrate_rapid"] - if args['dwell'] and args['dwelltime']: + if bool(args['dwell']) and args['dwelltime']: job_obj.dwell = True job_obj.dwelltime = float(args['dwelltime'])