diff --git a/src/BRepMesh/BRepMesh_Edge.cdl b/src/BRepMesh/BRepMesh_Edge.cdl index 83b1d7ad55..4d6c88d6a9 100755 --- a/src/BRepMesh/BRepMesh_Edge.cdl +++ b/src/BRepMesh/BRepMesh_Edge.cdl @@ -30,7 +30,11 @@ uses Boolean from Standard, DegreeOfFreedom from BRepMesh -is Create (vDebut : Integer from Standard; +is Create + returns Edge from BRepMesh; + ---C++: inline + + Create (vDebut : Integer from Standard; vFin : Integer from Standard; canMove : DegreeOfFreedom from BRepMesh) ---Purpose: Contructs a link beetween to vertices. diff --git a/src/BRepMesh/BRepMesh_Edge.lxx b/src/BRepMesh/BRepMesh_Edge.lxx index 3f726aea70..ebfe78d068 100755 --- a/src/BRepMesh/BRepMesh_Edge.lxx +++ b/src/BRepMesh/BRepMesh_Edge.lxx @@ -18,6 +18,12 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. +inline BRepMesh_Edge::BRepMesh_Edge() +: myFirstNode(-1), + myLastNode(-1), + myMovability(BRepMesh_Deleted) +{ +} inline Standard_Integer BRepMesh_Edge::FirstNode()const { diff --git a/src/MeshTest/MeshTest_PluginCommands.cxx b/src/MeshTest/MeshTest_PluginCommands.cxx index 98051763e4..93ab936390 100755 --- a/src/MeshTest/MeshTest_PluginCommands.cxx +++ b/src/MeshTest/MeshTest_PluginCommands.cxx @@ -44,6 +44,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include static Standard_Integer mpnames (Draw_Interpretor& , Standard_Integer , const char** ); static Standard_Integer mpsetdefaultname (Draw_Interpretor& , Standard_Integer , const char** ); @@ -330,6 +336,11 @@ static Standard_Integer triarea (Draw_Interpretor& di, int n, const char ** a) } //####################################################################### +Standard_Boolean IsEqual(const BRepMesh_Edge& theFirst, const BRepMesh_Edge& theSecond) +{ + return theFirst.IsEqual(theSecond); +} + static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a) { if (n < 2) return 1; @@ -354,12 +365,15 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a) Standard_Integer iF = aCheck.GetFaceNumWithFL(k); nbFree += nbEdge; di << "free links of face " << iF << "\n"; - const TopoDS_Face& aFace = TopoDS::Face(aMapF.FindKey(iF)); + + const TopoDS_Shape& aShape = aMapF.FindKey(iF); + const TopoDS_Face& aFace = TopoDS::Face(aShape); TopLoc_Location aLoc; Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc); const TColgp_Array1OfPnt& aPoints = aT->Nodes(); const TColgp_Array1OfPnt2d& aPoints2d = aT->UVNodes(); const gp_Trsf& trsf = aLoc.Transformation(); + TColgp_Array1OfPnt pnts(1,2); TColgp_Array1OfPnt2d pnts2d(1,2); for (i=1; i <= nbEdge; i++) { @@ -420,11 +434,87 @@ static Standard_Integer tricheck (Draw_Interpretor& di, int n, const char ** a) } // output errors summary to DRAW - if ( nbFree > 0 || nbErr > 0 || nbAsync > 0 || nbFreeNodes > 0 ) + if ( nbFree > 0 || nbErr > 0 || nbAsync > 0 || nbFreeNodes > 0) di << "Free_links " << nbFree << " Cross_face_errors " << nbErr << " Async_edges " << nbAsync << " Free_nodes " << nbFreeNodes << "\n"; + + + Standard_Integer aFaceId = 1; + TopExp_Explorer aFaceExp(shape, TopAbs_FACE); + for ( ; aFaceExp.More(); aFaceExp.Next(), ++aFaceId) + { + const TopoDS_Shape& aShape = aFaceExp.Current(); + const TopoDS_Face& aFace = TopoDS::Face(aShape); + + TopLoc_Location aLoc; + Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc); + + // Iterate boundary edges + NCollection_Map aBoundaryEdgeMap; + TopExp_Explorer anExp(aShape, TopAbs_EDGE); + for ( ; anExp.More(); anExp.Next() ) + { + TopLoc_Location anEdgeLoc; + const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current()); + Handle(Poly_PolygonOnTriangulation) aPoly = BRep_Tool::PolygonOnTriangulation(anEdge, aT, aLoc); + if (aPoly.IsNull()) + { + continue; + } + + const TColStd_Array1OfInteger& anIndices = aPoly->Nodes(); + Standard_Integer aLower = anIndices.Lower(); + Standard_Integer anUpper = anIndices.Upper(); + + Standard_Integer aPrevNode = -1; + for (Standard_Integer i = aLower; i <= anUpper; ++i) + { + Standard_Integer aNodeIdx = anIndices.Value(i); + if (i != aLower) + { + BRepMesh_Edge aLink(aPrevNode, aNodeIdx, BRepMesh_Frontier); + aBoundaryEdgeMap.Add(aLink); + } + aPrevNode = aNodeIdx; + } + } + + if (aBoundaryEdgeMap.Size() == 0) + { + break; + } + + const Poly_Array1OfTriangle& aTris = aT->Triangles(); + NCollection_Map aFreeEdgeMap; + Standard_Integer aTriNum = aTris.Length(); + for ( Standard_Integer aTriIndx = 1; aTriIndx <= aTriNum; aTriIndx++ ) + { + const Poly_Triangle& aTri = aTris(aTriIndx); + Standard_Integer aTriNodes[3] = { aTri.Value(1), aTri.Value(2), aTri.Value(3)}; + + for (Standard_Integer i = 1; i <= 3; ++i) + { + Standard_Integer aLastId = aTriNodes[i % 3]; + Standard_Integer aFirstId = aTriNodes[i - 1]; + + BRepMesh_Edge aLink(aFirstId, aLastId, BRepMesh_Free); + if (!aBoundaryEdgeMap.Contains(aLink)) + { + if (!aFreeEdgeMap.Add(aLink)) + { + aFreeEdgeMap.Remove(aLink); + } + } + } + } + + if (aFreeEdgeMap.Size() != 0) + { + di << "Not connected mesh inside face " << aFaceId << "\n"; + } + } return 0; } diff --git a/tests/bugs/demo/CR23409 b/tests/bugs/demo/CR23409 new file mode 100755 index 0000000000..378d4bd690 --- /dev/null +++ b/tests/bugs/demo/CR23409 @@ -0,0 +1,34 @@ +puts "============" +puts "CR23409" +puts "============" +puts "" +################################################################################### +# Tricheck command doesn't report problem when triangulation has unexpected holes +################################################################################### + +restore [locate_data_file bug23167_f397.brep] result +vinit +vsetdispmode 1 +vdisplay result +axo +fit +isos result 0 +triangles result +set info_bad [tricheck result] +if { [regexp "Not connected mesh inside face 1" $info_bad] != 1 } { + puts "Error : Tricheck command doesn't report message" +} + +tclean result +incmesh result 0.01 +set info_good [tricheck result] +if { [string compare $info_good "" ] != 0 } { + puts "Error : Tricheck command works incorrect when shape looks good" +} + +set 3dviewer 1 + + + + + diff --git a/tests/offset/wire_closed_outside_0_005/G7 b/tests/offset/wire_closed_outside_0_005/G7 old mode 100644 new mode 100755 index 500f77f0a9..ad511a2842 --- a/tests/offset/wire_closed_outside_0_005/G7 +++ b/tests/offset/wire_closed_outside_0_005/G7 @@ -1,3 +1,5 @@ +puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!" +puts "TODO ?OCC23068 ALL: Error : The offset can not be build." restore [locate_data_file offset_wire_084.brep] s set length 18.1766