CAM: fix handling of Active state and CoolantMode with nested dressups for some non-refactored postprocessors

This commit is contained in:
jffmichi
2025-05-14 21:43:31 +02:00
parent 1e6637a9c8
commit 2fd2ec5f5c
11 changed files with 50 additions and 113 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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)

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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)

View File

@@ -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: