diff --git a/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx b/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx index 4eefa24287..e987376b2c 100644 --- a/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx +++ b/src/BRepMesh/BRepMesh_ModelPreProcessor.cxx @@ -46,7 +46,8 @@ namespace void operator()(const Standard_Integer theFaceIndex) const { const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex); - if (aDFace->IsSet(IMeshData_Outdated)) + if (aDFace->IsSet(IMeshData_Outdated) || + aDFace->GetFace().IsNull()) { return; } @@ -119,7 +120,7 @@ namespace void operator()(const Standard_Integer theFaceIndex) const { const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex); - if (aDFace->GetSurface()->GetType() != GeomAbs_Cone) + if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure)) { return; } @@ -128,7 +129,7 @@ namespace for (Standard_Integer aEdgeIdx = 0; aEdgeIdx < aDWire->EdgesNb() - 1; ++aEdgeIdx) { const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge (aEdgeIdx); - + if (aDEdge->GetPCurve(aDFace.get(), TopAbs_FORWARD) != aDEdge->GetPCurve(aDFace.get(), TopAbs_REVERSED)) { if (aDEdge->GetCurve()->ParametersNb() == 2) @@ -146,7 +147,7 @@ namespace } } return; - } + } } } diff --git a/tests/bugs/mesh/bug32692_1 b/tests/bugs/mesh/bug32692_1 new file mode 100644 index 0000000000..db139cb93d --- /dev/null +++ b/tests/bugs/mesh/bug32692_1 @@ -0,0 +1,11 @@ +puts "=========" +puts "OCC32692: Crash when the input shape has some invalid topology" +puts "=========" +puts "" + +puts "REQUIRED ALL: Meshing statuses: SelfIntersectingWire Failure" + +restore [locate_data_file bug32692.brep] s +incmesh s 0.01 -parallel + +checktrinfo s -nod 7511 -tri 7625 -empty 9 -face 309 diff --git a/tests/bugs/mesh/bug32692_2 b/tests/bugs/mesh/bug32692_2 new file mode 100644 index 0000000000..3431ec9f61 --- /dev/null +++ b/tests/bugs/mesh/bug32692_2 @@ -0,0 +1,11 @@ +puts "=========" +puts "OCC32692: Crash when the input shape has some invalid topology" +puts "=========" +puts "" + +puts "REQUIRED ALL: Meshing statuses: Reused" + +restore [locate_data_file bug32692_broken_mesh.brep] s +incmesh s 0.01 -parallel + +checktrinfo s -nod 3 -tri 1 -face 1 diff --git a/tests/bugs/mesh/bug32692_3 b/tests/bugs/mesh/bug32692_3 new file mode 100644 index 0000000000..50d9334f43 --- /dev/null +++ b/tests/bugs/mesh/bug32692_3 @@ -0,0 +1,14 @@ +puts "=========" +puts "OCC32692: Crash when the input shape has some invalid topology" +puts "=========" +puts "" + +puts "REQUIRED ALL: Meshing statuses: OpenWire Failure Outdated" + +pload MODELING +cylinder c 0 0 0 10 +mkface f c + +incmesh f 0.01 -parallel + +checktrinfo f -nod 0 -tri 0 -face 1