Skip to content

Commit

Permalink
Part: do not expect a face to be infinite if meshing it has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 11, 2022
1 parent 9b5aabe commit fbb5555
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/Mod/Part/App/Tools.cpp
Expand Up @@ -613,11 +613,22 @@ Handle (Poly_Triangulation) Part::Tools::triangulationOfFace(const TopoDS_Face&
double v1 = adapt.FirstVParameter();
double v2 = adapt.LastVParameter();

// recreate a face with a clear boundary
u1 = std::max(-50.0, u1);
u2 = std::min( 50.0, u2);
v1 = std::max(-50.0, v1);
v2 = std::min( 50.0, v2);
auto selectRange = [](double& p1, double& p2) {
if (Precision::IsInfinite(p1) && Precision::IsInfinite(p2)) {
p1 = -50.0;
p2 = 50.0;
}
else if (Precision::IsInfinite(p1)) {
p1 = p2 - 100.0;
}
else if (Precision::IsInfinite(p2)) {
p2 = p1 + 100.0;
}
};

// recreate a face with a clear boundary in case it's infinite
selectRange(u1, u2);
selectRange(v1, v2);

Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
BRepBuilderAPI_MakeFace mkBuilder(surface, u1, u2, v1, v2
Expand Down

0 comments on commit fbb5555

Please sign in to comment.