From fefc7259038d2f25009a74d1bc07b726636b190e Mon Sep 17 00:00:00 2001 From: Patrick Felixberger Date: Mon, 2 Mar 2020 21:17:19 +0100 Subject: [PATCH] Fixed coolant with dressup --- src/Mod/Path/PathScripts/post/grbl_post.py | 46 +++++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/PathScripts/post/grbl_post.py b/src/Mod/Path/PathScripts/post/grbl_post.py index 1bc939f7ef..d080f24d05 100755 --- a/src/Mod/Path/PathScripts/post/grbl_post.py +++ b/src/Mod/Path/PathScripts/post/grbl_post.py @@ -258,6 +258,17 @@ def export(objectslist, filename, argstring): if not hasattr(obj, "Path"): print("The object " + obj.Name + " is not a path. Please select only path and Compounds.") return + + isActive = True + if hasattr(obj, "Active") or hasattr(obj, 'Base') and hasattr(obj.Base, "Active"): + if hasattr(obj, "Active"): + isActive = obj.Active + else: + isActive = obj.Base.Active + if isActive: + print("obj.Base.active true") + else: + print("obj.active false") # do the pre_op if OUTPUT_BCNC: @@ -269,16 +280,22 @@ def export(objectslist, filename, argstring): for line in PRE_OPERATION.splitlines(True): gcode += linenumber() + line + # get coolant mode + coolantMode = 'None' + if hasattr(obj, "CoolantMode") or hasattr(obj, 'Base') and hasattr(obj.Base, "CoolantMode"): + if hasattr(obj, "CoolantMode"): + coolantMode = obj.CoolantMode + else: + coolantMode = obj.Base.CoolantMode + # turn coolant on if required - if hasattr(obj, "CoolantMode"): - coolantMode = obj.CoolantMode - if OUTPUT_COMMENTS: - if not coolantMode == 'None': - gcode += linenumber() + '(Coolant On:' + coolantMode + ')\n' - if coolantMode == 'Flood': - gcode += linenumber() + 'M8' + '\n' - if coolantMode == 'Mist': - gcode += linenumber() + 'M7' + '\n' + if OUTPUT_COMMENTS and isActive: + if not coolantMode == 'None': + gcode += linenumber() + '(Coolant On:' + coolantMode + ')\n' + if coolantMode == 'Flood' and isActive: + gcode += linenumber() + 'M8' + '\n' + if coolantMode == 'Mist' and isActive: + gcode += linenumber() + 'M7' + '\n' # Parse the op gcode += parse(obj) @@ -290,12 +307,11 @@ def export(objectslist, filename, argstring): gcode += linenumber() + line # turn coolant off if required - if hasattr(obj, "CoolantMode"): - coolantMode = obj.CoolantMode - if not coolantMode == 'None': - if OUTPUT_COMMENTS: - gcode += linenumber() + '(Coolant Off:' + coolantMode + ')\n' - gcode += linenumber() +'M9' + '\n' + if not coolantMode == 'None': + if OUTPUT_COMMENTS and isActive: + gcode += linenumber() + '(Coolant Off:' + coolantMode + ')\n' + if isActive: + gcode += linenumber() +'M9' + '\n' # do the post_amble if OUTPUT_BCNC: