Try and catch errors when getting the tool profile

This commit is contained in:
Daniel Wood
2020-05-04 20:21:32 +01:00
parent 3003a16cc6
commit ed30e0421b

View File

@@ -783,11 +783,14 @@ cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res){
float cSimTool::GetToolProfileAt(float pos) // pos is -1..1 location along the radius of the tool (0 is center)
{
float radPos = std::abs(pos) * radius;
toolShapePoint test; test.radiusPos = radPos;
auto it = std::lower_bound(m_toolShape.begin(), m_toolShape.end(), test, toolShapePoint::less_than());
return it->heightPos;
try{
float radPos = std::abs(pos) * radius;
toolShapePoint test; test.radiusPos = radPos;
auto it = std::lower_bound(m_toolShape.begin(), m_toolShape.end(), test, toolShapePoint::less_than());
return it->heightPos;
}catch(...){
return 0;
}
}
bool cSimTool::isInside(const TopoDS_Shape& toolShape, Base::Vector3d pnt, float res)