From d26afa5d9054d1a675c9fbca83a55f59b82bb05a Mon Sep 17 00:00:00 2001 From: GeneGH Date: Wed, 10 Jun 2020 13:51:09 -0400 Subject: [PATCH] Path Simulator - Recognition of canned cycle cancellation The Path Simulator was designed to handle canned cycle drilling operations, G81, G82, and G83, but it expects the industry standard continuous uninterrupted set of G8x commands until the operation is completed. A recent change to the Path Drilling operation adds commands that cancel each G8x command immediately after that command is used. This confuses the Path Simulation function and leads to visual artifacts when the simulation is performed. G-code standards say that canned cycle cancellation can be accomplished by a specific G80 command or by any motion command in the set G0, G1, G2, or G3. This PR modifies PathSimulationGui.py to add recognition for canned cycle cancellation and resets the simulator to treat the next G8x command as the first element of a new series of canned cycles operations rather than a continuation of the previous series. --- src/Mod/Path/PathScripts/PathSimulatorGui.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSimulatorGui.py b/src/Mod/Path/PathScripts/PathSimulatorGui.py index d692aa7512..de877bd207 100644 --- a/src/Mod/Path/PathScripts/PathSimulatorGui.py +++ b/src/Mod/Path/PathScripts/PathSimulatorGui.py @@ -192,15 +192,20 @@ class PathSimulation: pathSolid = None if cmd.Name in ['G0']: + self.firstDrill = True self.curpos = self.RapidMove(cmd, self.curpos) if cmd.Name in ['G1', 'G2', 'G3']: + self.firstDrill = True if self.skipStep: self.curpos = self.RapidMove(cmd, self.curpos) else: (pathSolid, self.curpos) = self.GetPathSolid(self.tool, cmd, self.curpos) + + if cmd.Name in ['G80']: + self.firstDrill = True if cmd.Name in ['G81', 'G82', 'G83']: if self.firstDrill: - extendcommand = Path.Command('G0', {"X": 0.0, "Y": 0.0, "Z": cmd.r}) + extendcommand = Path.Command('G0', {"Z": cmd.r}) self.curpos = self.RapidMove(extendcommand, self.curpos) self.firstDrill = False extendcommand = Path.Command('G0', {"X": cmd.x, "Y": cmd.y, "Z": cmd.r}) @@ -248,14 +253,17 @@ class PathSimulation: cmd = self.opCommands[self.icmd] # for cmd in job.Path.Commands: if cmd.Name in ['G0', 'G1', 'G2', 'G3']: + self.firstDrill = True self.curpos = self.voxSim.ApplyCommand(self.curpos, cmd) if not self.disableAnim: self.cutTool.Placement = self.curpos (self.cutMaterial.Mesh, self.cutMaterialIn.Mesh) = self.voxSim.GetResultMesh() + if cmd.Name in ['G80']: + self.firstDrill = True if cmd.Name in ['G81', 'G82', 'G83']: extendcommands = [] if self.firstDrill: - extendcommands.append(Path.Command('G0', {"X": 0.0, "Y": 0.0, "Z": cmd.r})) + extendcommands.append(Path.Command('G0', {"Z": cmd.r})) self.firstDrill = False extendcommands.append(Path.Command('G0', {"X": cmd.x, "Y": cmd.y, "Z": cmd.r})) extendcommands.append(Path.Command('G1', {"X": cmd.x, "Y": cmd.y, "Z": cmd.z}))