From c1b471588b4f787204ee6aa6324bddaefbebc895 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Fri, 12 Mar 2021 13:12:09 -0600 Subject: [PATCH] [PATH] Fix bug with spindle not restarting if output is split by operation spindle should restart when next file is loaded --- src/Mod/Path/PathScripts/PathJob.py | 12 ++++++++++++ src/Mod/Path/PathScripts/PathPost.py | 27 +++++++-------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 7db787c08e..655528b72d 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -296,6 +296,18 @@ class ObjectJob: obj.addProperty("App::PropertyString", "CycleTime", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Operations Cycle Time Estimation")) obj.setEditorMode('CycleTime', 1) # read-only + if not hasattr(obj, "Fixtures"): + obj.addProperty("App::PropertyStringList", "Fixtures", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "The Work Coordinate Systems for the Job")) + obj.Fixtures = ['G54'] + + if not hasattr(obj, "OrderOutputBy"): + obj.addProperty("App::PropertyEnumeration", "OrderOutputBy", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "If multiple WCS, order the output this way")) + obj.OrderOutputBy = ['Fixture', 'Tool', 'Operation'] + + if not hasattr(obj, "SplitOutput"): + obj.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Split output into multiple gcode files")) + obj.SplitOutput = False + def onChanged(self, obj, prop): if prop == "PostProcessor" and obj.PostProcessor: processor = PostProcessor.load(obj.PostProcessor) diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index ab5ba76845..fec6ddd3a5 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -236,7 +236,7 @@ class CommandPathPost: elif hasattr(sel, "Path"): try: job = PathUtils.findParentJob(sel) - except Exception: # pylint: disable=broad-except + except Exception: job = None else: job = None @@ -261,22 +261,9 @@ class CommandPathPost: PathLog.debug("about to postprocess job: {}".format(job.Name)) - # Build up an ordered list of operations and tool changes. - # Then post-the ordered list - if hasattr(job, "Fixtures"): - wcslist = job.Fixtures - else: - wcslist = ['G54'] - - if hasattr(job, "OrderOutputBy"): - orderby = job.OrderOutputBy - else: - orderby = "Operation" - - if hasattr(job, "SplitOutput"): - split = job.SplitOutput - else: - split = False + wcslist = job.Fixtures + orderby = job.OrderOutputBy + split = job.SplitOutput postlist = [] @@ -332,7 +319,7 @@ class CommandPathPost: for idx, obj in enumerate(job.Operations.Group): # check if the operation is active - active = PathUtil.opProperty(obj, 'Active') + active = PathUtil.opProperty(obj, 'Active') tc = PathUtil.toolControllerForOp(obj) if tc is None or tc.ToolNumber == currTool and active: @@ -380,14 +367,14 @@ class CommandPathPost: firstFixture = False tc = PathUtil.toolControllerForOp(obj) if tc is not None: - if tc.ToolNumber != currTool: + if job.SplitOutput or (tc.ToolNumber != currTool): sublist.append(tc) currTool = tc.ToolNumber sublist.append(obj) postlist.append(sublist) fail = True - rc = '' # pylint: disable=unused-variable + rc = '' if split: for slist in postlist: (fail, rc, filename) = self.exportObjectsWith(slist, job)