diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py index ebd388669c..acf4ff8fea 100644 --- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py +++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py @@ -809,9 +809,39 @@ class ObjectDressup: edge = None t = 0 - #for cmd in commands: - # print(cmd) - return Path.Path(commands) + lastCmd = Path.Command('G0', {'X': 0.0, 'Y': 0.0, 'Z': 0.0}); + outCommands = [] + + horizFeed = obj.ToolController.HorizFeed.Value + vertFeed = obj.ToolController.VertFeed.Value + horizRapid = obj.ToolController.HorizRapid.Value + vertRapid = obj.ToolController.VertRapid.Value + + for cmd in commands: + params = cmd.Parameters + zVal = params.get('Z', None) + zVal2 = lastCmd.Parameters.get('Z', None) + + zVal = zVal and round(zVal, 8) + zVal2 = zVal2 and round(zVal2, 8) + + if cmd.Name in ['G1', 'G2', 'G3', 'G01', 'G02', 'G03']: + if zVal is not None and zVal2 != zVal: + params['F'] = vertFeed + else: + params['F'] = horizFeed + lastCmd = cmd + + elif cmd.Name in ['G0', 'G00']: + if zVal is not None and zVal2 != zVal: + params['F'] = vertRapid + else: + params['F'] = horizRapid + lastCmd = cmd + + outCommands.append(Path.Command(cmd.Name, params)) + + return Path.Path(outCommands) def problems(self): return filter(lambda m: m.haveProblem, self.mappers)