From 530029bf2951c506f3339efd9a83735aae99c52e Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Mon, 2 Mar 2020 12:58:55 +0000 Subject: [PATCH 1/3] skip inactive operations --- src/Mod/Path/PathScripts/post/linuxcnc_post.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mod/Path/PathScripts/post/linuxcnc_post.py b/src/Mod/Path/PathScripts/post/linuxcnc_post.py index 0219ec223f..2c9337882b 100644 --- a/src/Mod/Path/PathScripts/post/linuxcnc_post.py +++ b/src/Mod/Path/PathScripts/post/linuxcnc_post.py @@ -185,6 +185,14 @@ def export(objectslist, filename, argstring): for obj in objectslist: + # Skip inactive operations + if hasattr(obj, 'Active'): + if not obj.Active: + continue + if hasattr(obj, 'Base') and hasattr(obj.Base, 'Active'): + if not obj.Base.Active: + continue + # fetch machine details job = PathUtils.findParentJob(obj) From 974bcbc059b32e8e92a3e910a625bf86c5451ec0 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Mon, 2 Mar 2020 13:27:14 +0000 Subject: [PATCH 2/3] 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: From 0b52e3ac078088f89c06bb35b1000e5aae593c7e Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Mon, 2 Mar 2020 13:34:08 +0000 Subject: [PATCH 3/3] Stop the spindle before tool changes. --- src/Mod/Path/PathScripts/post/linuxcnc_post.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/post/linuxcnc_post.py b/src/Mod/Path/PathScripts/post/linuxcnc_post.py index 8673c50d1d..372bd40974 100644 --- a/src/Mod/Path/PathScripts/post/linuxcnc_post.py +++ b/src/Mod/Path/PathScripts/post/linuxcnc_post.py @@ -366,8 +366,8 @@ def parse(pathobj): # Check for Tool Change: if command == 'M6': - # if OUTPUT_COMMENTS: - # out += linenumber() + "(begin toolchange)\n" + # stop the spindle + out += linenumber() + "M5\n" for line in TOOL_CHANGE.splitlines(True): out += linenumber() + line