Skip to content

Commit

Permalink
Try and catch errors when getting the tool profile
Browse files Browse the repository at this point in the history
  • Loading branch information
dubstar-04 committed May 4, 2020
1 parent 15a1d34 commit 65dcdf1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Mod/Path/PathSimulator/App/VolSim.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 65dcdf1

Please sign in to comment.