diff --git a/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py b/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py index f7861567f3..edf4951ddd 100644 --- a/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py +++ b/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py @@ -31,6 +31,7 @@ import Path import argparse import datetime import shlex +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils import PathScripts.PathUtils as PathUtils from builtins import open as pyopen @@ -232,12 +233,9 @@ 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 + if not PathUtil.activeForOp(obj): + continue + if hasattr(obj, "ClearanceHeight"): clearanceHeight = obj.ClearanceHeight.Value @@ -257,12 +255,7 @@ def export(objectslist, filename, argstring): ) # 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/estlcam_post.py b/src/Mod/CAM/Path/Post/scripts/estlcam_post.py index 2a571766a1..070bfa64fb 100644 --- a/src/Mod/CAM/Path/Post/scripts/estlcam_post.py +++ b/src/Mod/CAM/Path/Post/scripts/estlcam_post.py @@ -263,7 +263,7 @@ def export(objectslist, filename, argstring): continue # Skip inactive operations - if PathUtil.opProperty(obj, "Active") is False: + if not PathUtil.activeForOp(obj): continue # do the pre_op @@ -273,12 +273,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/fangling_post.py b/src/Mod/CAM/Path/Post/scripts/fangling_post.py index c6938c66b5..636bd2bc8b 100644 --- a/src/Mod/CAM/Path/Post/scripts/fangling_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fangling_post.py @@ -38,6 +38,7 @@ import datetime import shlex # from PathScripts import PostUtils +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils from PathScripts import PathUtils from builtins import open as pyopen @@ -216,12 +217,8 @@ 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 + if not PathUtil.activeForOp(obj): + continue # fetch machine details job = PathUtils.findParentJob(obj) diff --git a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py index 4487f70457..b708d51a9b 100644 --- a/src/Mod/CAM/Path/Post/scripts/fanuc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py @@ -29,6 +29,7 @@ import argparse import datetime import shlex import os.path +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils import PathScripts.PathUtils as PathUtils from builtins import open as pyopen @@ -227,12 +228,8 @@ 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 + if not PathUtil.activeForOp(obj): + continue # do the pre_op if OUTPUT_COMMENTS: @@ -242,12 +239,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/grbl_post.py b/src/Mod/CAM/Path/Post/scripts/grbl_post.py index 3dd7f267af..497da87a57 100644 --- a/src/Mod/CAM/Path/Post/scripts/grbl_post.py +++ b/src/Mod/CAM/Path/Post/scripts/grbl_post.py @@ -315,7 +315,7 @@ def export(objectslist, filename, argstring): return # Skip inactive operations - if PathUtil.opProperty(obj, "Active") is False: + if not PathUtil.activeForOp(obj): continue # do the pre_op @@ -329,12 +329,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py index 5a0e676936..358eefe4bf 100644 --- a/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py @@ -27,6 +27,7 @@ import Path import argparse import datetime import shlex +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils import PathScripts.PathUtils as PathUtils from builtins import open as pyopen @@ -203,12 +204,8 @@ 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 + if not PathUtil.activeForOp(obj): + continue # do the pre_op if OUTPUT_COMMENTS: @@ -218,12 +215,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py b/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py index a450895333..c0eb947fd3 100644 --- a/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py +++ b/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py @@ -27,6 +27,7 @@ import Path import argparse import datetime import shlex +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils import PathScripts.PathUtils as PathUtils from builtins import open as pyopen @@ -203,12 +204,8 @@ 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 + if not PathUtil.activeForOp(obj): + continue # do the pre_op if OUTPUT_COMMENTS: @@ -221,12 +218,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/marlin_post.py b/src/Mod/CAM/Path/Post/scripts/marlin_post.py index 6705a84797..23d8188389 100644 --- a/src/Mod/CAM/Path/Post/scripts/marlin_post.py +++ b/src/Mod/CAM/Path/Post/scripts/marlin_post.py @@ -357,7 +357,7 @@ def export(objectslist, filename, argstring): return # Skip inactive operations: - if PathUtil.opProperty(obj, "Active") is False: + if not PathUtil.activeForOp(obj): continue # Do the pre_op: @@ -371,12 +371,7 @@ def export(objectslist, filename, argstring): gcode += linenumber() + line # Get coolant mode: - coolantMode = "None" # None is the word returned from the operation - 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 + coolantMode = PathUtil.coolantModeForOp(obj) # Turn coolant on if required: if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/rrf_post.py b/src/Mod/CAM/Path/Post/scripts/rrf_post.py index d578a9b17f..b72cec3c69 100644 --- a/src/Mod/CAM/Path/Post/scripts/rrf_post.py +++ b/src/Mod/CAM/Path/Post/scripts/rrf_post.py @@ -355,7 +355,7 @@ def export(objectslist, filename, argstring): return # Skip inactive operations: - if PathUtil.opProperty(obj, "Active") is False: + if not PathUtil.activeForOp(obj): continue # Do the pre_op: @@ -369,12 +369,7 @@ def export(objectslist, filename, argstring): gcode += linenumber() + line # Get coolant mode: - coolantMode = "None" # None is the word returned from the operation - 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 + coolantMode = PathUtil.coolantModeForOp(obj) # Turn coolant on if required: if OUTPUT_COMMENTS: diff --git a/src/Mod/CAM/Path/Post/scripts/uccnc_post.py b/src/Mod/CAM/Path/Post/scripts/uccnc_post.py index b44a77c506..4634ff0390 100644 --- a/src/Mod/CAM/Path/Post/scripts/uccnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/uccnc_post.py @@ -33,6 +33,7 @@ import FreeCAD from FreeCAD import Units import Path +import Path.Base.Util as PathUtil import PathScripts.PathUtils as PathUtils import argparse import datetime @@ -458,18 +459,17 @@ def export(objectslist, filename, argstring): gcode += append(line) # turn coolant on if required - if hasattr(obj, "CoolantMode"): - coolantMode = obj.CoolantMode - if coolantMode == "Mist": - if OUTPUT_COMMENTS: - gcode += append("M7 (coolant: mist on)\n") - else: - gcode += append("M7\n") - if coolantMode == "Flood": - if OUTPUT_COMMENTS: - gcode += append("M8 (coolant: flood on)\n") - else: - gcode += append("M8\n") + coolantMode = PathUtil.coolantModeForOp(obj) + if coolantMode == "Mist": + if OUTPUT_COMMENTS: + gcode += append("M7 (coolant: mist on)\n") + else: + gcode += append("M7\n") + if coolantMode == "Flood": + if OUTPUT_COMMENTS: + gcode += append("M8 (coolant: flood on)\n") + else: + gcode += append("M8\n") # process the operation gcode if OUTPUT_COMMENTS: @@ -483,13 +483,12 @@ def export(objectslist, filename, argstring): gcode += append(line) # turn coolant off if required - if hasattr(obj, "CoolantMode"): - coolantMode = obj.CoolantMode - if not coolantMode == "None": - if OUTPUT_COMMENTS: - gcode += append("M9 (coolant: off)\n") - else: - gcode += append("M9\n") + if not coolantMode == "None": + if OUTPUT_COMMENTS: + gcode += append("M9 (coolant: off)\n") + else: + gcode += append("M9\n") + if OUTPUT_COMMENTS: gcode += append("(operation finalised: %s)\n" % obj.Label) diff --git a/src/Mod/CAM/Path/Post/scripts/wedm_post.py b/src/Mod/CAM/Path/Post/scripts/wedm_post.py index 1b9396f8b9..fc745ba8e1 100644 --- a/src/Mod/CAM/Path/Post/scripts/wedm_post.py +++ b/src/Mod/CAM/Path/Post/scripts/wedm_post.py @@ -30,6 +30,7 @@ import Path import argparse import datetime import shlex +import Path.Base.Util as PathUtil import Path.Post.Utils as PostUtils import PathScripts.PathUtils as PathUtils from builtins import open as pyopen @@ -279,12 +280,8 @@ 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 + if not PathUtil.activeForOp(obj): + continue # fetch machine details job = PathUtils.findParentJob(obj) @@ -319,12 +316,7 @@ def export(objectslist, filename, argstring): 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 + coolantMode = PathUtil.coolantModeForOp(obj) # turn coolant on if required if OUTPUT_COMMENTS: