Skip to content

Commit

Permalink
Part: in function to create a part handle meshes with defects
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jan 18, 2022
1 parent ead1bce commit 113a587
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Mod/Part/App/TopoShape.cpp
Expand Up @@ -3614,7 +3614,9 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
Edges[key2] = edge;
}
else {
Edges[key2] = BRepBuilderAPI_MakeEdge(Vertexes[p1], Vertexes[p2]);
BRepBuilderAPI_MakeEdge mkEdge(Vertexes[p1], Vertexes[p2]);
if (mkEdge.IsDone())
Edges[key2] = mkEdge.Edge();
}
};
auto GetEdge = [&Edges](uint32_t p1, uint32_t p2) {
Expand All @@ -3638,10 +3640,14 @@ void TopoShape::setFaces(const std::vector<Base::Vector3d> &Points,
p2.SetCoord(x2,y2,z2);
p3.SetCoord(x3,y3,z3);

if ((!(p1.IsEqual(p2,0.0))) && (!(p1.IsEqual(p3,0.0)))) {
// Avoid very tiny edges as this may result into broken faces. The tolerance is Approximation
// because Confusion might be too tight.
if ((!(p1.IsEqual(p2, Precision::Approximation()))) && (!(p1.IsEqual(p3, Precision::Approximation())))) {
const TopoDS_Edge& e1 = GetEdge(it->I1, it->I2);
const TopoDS_Edge& e2 = GetEdge(it->I2, it->I3);
const TopoDS_Edge& e3 = GetEdge(it->I3, it->I1);
if (e1.IsNull() || e2.IsNull() || e3.IsNull())
continue;

newWire = BRepBuilderAPI_MakeWire(e1, e2, e3);
if (!newWire.IsNull()) {
Expand Down

0 comments on commit 113a587

Please sign in to comment.