check the toolbit shape is valid
This commit is contained in:
@@ -134,6 +134,10 @@ class PathSimulation:
|
||||
# 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
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user