From 354e63ddb77689bdcf0004bcdf5a765f3ec1d3ca Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Mon, 2 Mar 2020 13:27:14 +0000 Subject: [PATCH] Handle coolant for ops using dressups --- .../Path/PathScripts/post/linuxcnc_post.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/PathScripts/post/linuxcnc_post.py b/src/Mod/Path/PathScripts/post/linuxcnc_post.py index 2c9337882b..8673c50d1d 100644 --- a/src/Mod/Path/PathScripts/post/linuxcnc_post.py +++ b/src/Mod/Path/PathScripts/post/linuxcnc_post.py @@ -218,16 +218,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: + if not coolantMode == 'None': + gcode += linenumber() + '(Coolant On:' + coolantMode + ')\n' + if coolantMode == 'Flood': + gcode += linenumber() + 'M8' + '\n' + if coolantMode == 'Mist': + gcode += linenumber() + 'M7' + '\n' # process the operation gcode gcode += parse(obj) @@ -239,12 +245,10 @@ 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: + gcode += linenumber() + '(Coolant Off:' + coolantMode + ')\n' + gcode += linenumber() +'M9' + '\n' # do the post_amble if OUTPUT_COMMENTS: