Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
check the toolbit shape is valid
  • Loading branch information
dubstar-04 committed May 4, 2020
1 parent 2c3a72f commit ef4074a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Mod/Path/PathScripts/PathSimulatorGui.py
Expand Up @@ -134,6 +134,10 @@ def SetupOperation(self, itool):
# handle tool bits
self.cutTool.Shape = self.tool.Shape

if not self.cutTool.Shape.isValid() or self.cutTool.Shape.isNull():
self.EndSimulation()
raise RuntimeError("Path Simulation: Error in tool geometry - {}".format(self.tool.Name))

self.cutTool.ViewObject.show()
self.voxSim.SetToolShape(self.cutTool.Shape, 0.05 * self.accuracy)
self.icmd = 0
Expand Down
10 changes: 9 additions & 1 deletion src/Mod/Path/PathSimulator/App/VolSim.cpp
Expand Up @@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include <Base/Console.h>

#include <BRepCheck_Analyzer.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <gp_Pnt.hxx>

Expand Down Expand Up @@ -717,7 +718,14 @@ void Point3D::UpdateCmd(Path::Command & cmd)
// Simulation tool
//************************************************************************************************************
cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res){


BRepCheck_Analyzer aChecker(toolShape);
bool shapeIsValid = aChecker.IsValid() ? true : false;

if(!shapeIsValid){
throw Base::RuntimeError("Path Simulation: Error in tool geometry");
}

Bnd_Box boundBox;
BRepBndLib::Add(toolShape, boundBox);

Expand Down

0 comments on commit ef4074a

Please sign in to comment.