From d9b03e6cad66c814760f222580d4c38a796f107a Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sun, 1 Mar 2020 16:46:29 +0000 Subject: [PATCH 1/2] Only post tools for active operations Only post tools and tool changes for active operations. --- src/Mod/Path/PathScripts/PathPost.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 9799a2d201..4a7cf1da5e 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -299,7 +299,7 @@ class CommandPathPost: # Now generate the gcode for obj in job.Operations.Group: tc = PathUtil.toolControllerForOp(obj) - if tc is not None: + if tc is not None and obj.Active: if tc.ToolNumber != currTool: sublist.append(tc) PathLog.debug("Appending TC: {}".format(tc.Name)) @@ -330,13 +330,13 @@ class CommandPathPost: for idx, obj in enumerate(job.Operations.Group): tc = PathUtil.toolControllerForOp(obj) - if tc is None or tc.ToolNumber == currTool: + if tc is None or tc.ToolNumber == currTool or not obj.Active: curlist.append(obj) - elif tc.ToolNumber != currTool and currTool is None: # first TC + elif tc.ToolNumber != currTool and currTool is None and obj.Active: # first TC sublist.append(tc) curlist.append(obj) currTool = tc.ToolNumber - elif tc.ToolNumber != currTool and currTool is not None: # TC + elif tc.ToolNumber != currTool and currTool is not None and obj.Active: # TC for fixture in fixturelist: sublist.append(fixture) sublist.extend(curlist) @@ -373,7 +373,7 @@ class CommandPathPost: for fixture in fixturelist: sublist.append(fixture) tc = PathUtil.toolControllerForOp(obj) - if tc is not None: + if tc is not None and obj.Active: if tc.ToolNumber != currTool: sublist.append(tc) currTool = tc.ToolNumber From 823f4261427e971318e965fb08bf4cae37b65585 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sun, 1 Mar 2020 20:00:03 +0000 Subject: [PATCH 2/2] Don't change z height without a tool set. This commit omits the height change for the initial WCS. For all subsequent WCS changes we set the height as we know what tool we have in the machine. --- src/Mod/Path/PathScripts/PathPost.py | 49 +++++++++++++++------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 4a7cf1da5e..ad754bfc7b 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -287,12 +287,14 @@ class CommandPathPost: # fixture before moving to the next. currTool = None - for f in wcslist: + for index, f in enumerate(wcslist): # create an object to serve as the fixture path fobj = _TempObject() c1 = Path.Command(f) - c2 = Path.Command("G0 Z" + str(job.Stock.Shape.BoundBox.ZMax + job.SetupSheet.ClearanceHeightOffset.Value)) - fobj.Path = Path.Path([c1, c2]) + fobj.Path = Path.Path([c1]) + if index != 0: + c2 = Path.Command("G0 Z" + str(job.Stock.Shape.BoundBox.ZMax + job.SetupSheet.ClearanceHeightOffset.Value)) + fobj.Path.addCommands(c2) fobj.InList.append(job) sublist = [fobj] @@ -356,29 +358,30 @@ class CommandPathPost: # Order by operation means ops are done in each fixture in # sequence. currTool = None - fixturelist = [] - for f in wcslist: - # create an object to serve as the fixture path - fobj = _TempObject() - c1 = Path.Command(f) - c2 = Path.Command("G0 Z" + str(job.Stock.Shape.BoundBox.ZMax + job.SetupSheet.ClearanceHeightOffset.Value)) - fobj.Path = Path.Path([c1, c2]) - fobj.InList.append(job) - fixturelist.append(fobj) + firstFixture = True # Now generate the gcode for obj in job.Operations.Group: - sublist = [] - PathLog.debug("obj: {}".format(obj.Name)) - for fixture in fixturelist: - sublist.append(fixture) - tc = PathUtil.toolControllerForOp(obj) - if tc is not None and obj.Active: - if tc.ToolNumber != currTool: - sublist.append(tc) - currTool = tc.ToolNumber - sublist.append(obj) - postlist.append(sublist) + if obj.Active: + sublist = [] + PathLog.debug("obj: {}".format(obj.Name)) + for f in wcslist: + fobj = _TempObject() + c1 = Path.Command(f) + fobj.Path = Path.Path([c1]) + if not firstFixture: + c2 = Path.Command("G0 Z" + str(job.Stock.Shape.BoundBox.ZMax + job.SetupSheet.ClearanceHeightOffset.Value)) + fobj.Path.addCommands(c2) + fobj.InList.append(job) + sublist.append(fobj) + firstFixture = False + tc = PathUtil.toolControllerForOp(obj) + if tc is not None: + if tc.ToolNumber != currTool: + sublist.append(tc) + currTool = tc.ToolNumber + sublist.append(obj) + postlist.append(sublist) fail = True rc = '' # pylint: disable=unused-variable