From d18e89f146d3664907d4f758413fedb3f0a183ab Mon Sep 17 00:00:00 2001 From: Shai Seger Date: Wed, 22 Nov 2017 09:29:23 +0200 Subject: [PATCH] Make simulator work with non standard operations. --- src/Mod/Path/PathScripts/PathSimulatorGui.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSimulatorGui.py b/src/Mod/Path/PathScripts/PathSimulatorGui.py index 20d462b0e1..24c11e5024 100644 --- a/src/Mod/Path/PathScripts/PathSimulatorGui.py +++ b/src/Mod/Path/PathScripts/PathSimulatorGui.py @@ -102,17 +102,23 @@ class PathSimulation: else: self.cutMaterial.Shape = self.stock self.busy = False - self.SetupOperation(0) + self.tool = None + for i in range(len(self.activeOps)): + self.SetupOperation(0) + if (self.tool is not None): + break self.iprogress = 0 self.UpdateProgress() def SetupOperation(self, itool): self.operation = self.activeOps[itool] - self.tool = self.operation.ToolController.Tool - toolProf = self.CreateToolProfile(self.tool, Vector(0,1,0), Vector(0,0,0), self.tool.Diameter / 2.0) - self.cutTool.Shape = Part.makeSolid(toolProf.revolve(Vector(0,0,0), Vector(0,0,1))) - self.cutTool.ViewObject.show() - self.voxSim.SetCurrentTool(self.tool) + if hasattr(self.operation, "ToolController"): + self.tool = self.operation.ToolController.Tool + if (self.tool is not None): + toolProf = self.CreateToolProfile(self.tool, Vector(0,1,0), Vector(0,0,0), self.tool.Diameter / 2.0) + self.cutTool.Shape = Part.makeSolid(toolProf.revolve(Vector(0,0,0), Vector(0,0,1))) + self.cutTool.ViewObject.show() + self.voxSim.SetCurrentTool(self.tool) self.icmd = 0 self.curpos = FreeCAD.Placement(self.initialPos, self.stdrot) #self.cutTool.Placement = FreeCAD.Placement(self.curpos, self.stdrot)