diff --git a/src/Mod/Path/PathScripts/PathSimulatorGui.py b/src/Mod/Path/PathScripts/PathSimulatorGui.py index 8d60e472fd..6e9a16b527 100644 --- a/src/Mod/Path/PathScripts/PathSimulatorGui.py +++ b/src/Mod/Path/PathScripts/PathSimulatorGui.py @@ -480,22 +480,30 @@ class PathSimulation: self.cutTool.ViewObject.hide() self.iprogress = 0 self.EndSimulation() + + def InvalidOperation(self): + if len(self.activeOps) == 0: + return True + if (self.tool == None): + TSError("No tool assigned for the operation") + return True + return false def SimFF(self): - if len(self.activeOps) == 0: + if self.InvalidOperation(): return self.GuiBusy(True) self.timer.start(1) self.disableAnim = True def SimStep(self): - if len(self.activeOps) == 0: + if self.InvalidOperation(): return self.disableAnim = False self.PerformCut() def SimPlay(self): - if len(self.activeOps) == 0: + if self.InvalidOperation(): return self.disableAnim = False self.GuiBusy(True) diff --git a/src/Mod/Path/PathSimulator/App/PathSim.cpp b/src/Mod/Path/PathSimulator/App/PathSim.cpp index bc3e2b7ef5..2901c13d3a 100644 --- a/src/Mod/Path/PathSimulator/App/PathSim.cpp +++ b/src/Mod/Path/PathSimulator/App/PathSim.cpp @@ -125,21 +125,24 @@ Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd) Point3D fromPos(*pos); Point3D toPos(*pos); toPos.UpdateCmd(*cmd); - if (cmd->Name == "G0" || cmd->Name == "G1") + if (m_tool != NULL) { - m_stock->ApplyLinearTool(fromPos, toPos, *m_tool); - } - else if (cmd->Name == "G2") - { - Vector3d vcent = cmd->getCenter(); - Point3D cent(vcent); - m_stock->ApplyCircularTool(fromPos, toPos, cent, *m_tool, false); - } - else if (cmd->Name == "G3") - { - Vector3d vcent = cmd->getCenter(); - Point3D cent(vcent); - m_stock->ApplyCircularTool(fromPos, toPos, cent, *m_tool, true); + if (cmd->Name == "G0" || cmd->Name == "G1") + { + m_stock->ApplyLinearTool(fromPos, toPos, *m_tool); + } + else if (cmd->Name == "G2") + { + Vector3d vcent = cmd->getCenter(); + Point3D cent(vcent); + m_stock->ApplyCircularTool(fromPos, toPos, cent, *m_tool, false); + } + else if (cmd->Name == "G3") + { + Vector3d vcent = cmd->getCenter(); + Point3D cent(vcent); + m_stock->ApplyCircularTool(fromPos, toPos, cent, *m_tool, true); + } } Base::Placement *plc = new Base::Placement();