]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL8395: Improve CheckCompoundOfBlocks
authorjfa <jfa@opencascade.com>
Tue, 15 Mar 2005 12:06:48 +0000 (12:06 +0000)
committerjfa <jfa@opencascade.com>
Tue, 15 Mar 2005 12:06:48 +0000 (12:06 +0000)
src/GEOMAlgo/BlockFix_CheckTool.cdl
src/GEOMAlgo/BlockFix_CheckTool.cxx
src/GEOMAlgo/BlockFix_CheckTool.hxx

index 959ada7235ffbcf83f719fefde67a5e45a7d61e7..d05d517fd4084203be393ba4a257e2fc07ed1156 100644 (file)
@@ -38,6 +38,7 @@ fields
     myNbSolids   : Integer;
     myNbBlocks   : Integer;
     myPossibleBlocks : SequenceOfShape from TopTools;
+    myNbDegen    : Integer;
     myNbUF       : Integer;
     myNbUE       : Integer;
     myNbUFUE     : Integer;
index ba902ba5ab6edd47d314af5e5d70eb3babb03bcd..2c386c961faf38cd532a88223f8a803d4f0e60c1 100644 (file)
@@ -54,6 +54,7 @@ void BlockFix_CheckTool::Perform()
 {
   myNbSolids=0;
   myNbBlocks=0;
+  myNbDegen=0;
   myNbUF=0;
   myNbUE=0;
   myNbUFUE=0;
@@ -108,13 +109,29 @@ void BlockFix_CheckTool::Perform()
       }
     }
 
-    Standard_Integer ne=0;
+    Standard_Integer nbe=0;
+    TopTools_MapOfShape DegenEdges;
     TopExp_Explorer expe;
-    for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) ne++;
-    ne = ne/2;
-    if(ne<12)
+    for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) {
+      TopoDS_Edge E = TopoDS::Edge(expe.Current());
+      if(BRep_Tool::Degenerated(E)) {
+        if(!DegenEdges.Contains(E)) {
+          DegenEdges.Add(E);
+        }
+      }
+      else {
+        nbe++;
+      }
+    }
+    if( nbe==24 && DegenEdges.Extent()>0 ) {
+      IsBlock=Standard_False;
+      myNbDegen++;
+      myPossibleBlocks.Append(aSolid);
+      continue;
+    }
+    if(nbe<24)
       IsBlock=Standard_False;
-    if(ne>12) {
+    if(nbe>24) {
       IsBlock=Standard_False;
       // check edges unification
       // creating map of edge faces
@@ -141,13 +158,13 @@ void BlockFix_CheckTool::Perform()
             }
           }
         }
-        Standard_Integer i = 1;
-        for (; i <= aMapFacesEdges.Extent(); i++) {
+        Standard_Integer i=1;
+        for(; i<=aMapFacesEdges.Extent(); i++) {
           const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
-          if (ListEdges.Extent() > 1) break;
+          if(ListEdges.Extent()>1) break;
         }
-        if (i <= aMapFacesEdges.Extent()) {
-          MayBeUE = Standard_True;
+        if(i<=aMapFacesEdges.Extent()) {
+          MayBeUE=Standard_True;
           break;
         }
       }
@@ -214,11 +231,11 @@ void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
     S<<"  total number of solids = "<<myNbSolids<<endl;
     S<<"  including: number of good blocks = "<<myNbBlocks<<endl;
     S<<"             number of possible blocks = "<<NbPossibleBlocks()<<endl;
-    Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
-    S<<"             number of impossible blocks = "<<nbtmp<<endl;
-    S<<"             including: need unionfaces = "<<myNbUF<<endl;
+    S<<"             including: need remove degenerative = "<<myNbDegen<<endl;
+    S<<"                        need unionfaces = "<<myNbUF<<endl;
     S<<"                        need unionedges = "<<myNbUE<<endl;
     S<<"                        need both unionfaces and unionedges = "<<myNbUFUE<<endl;
+    Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
+    S<<"             number of impossible blocks = "<<nbtmp<<endl;
   }
 }
-
index 9e761893133bd0e0ffd4ad49602c90868dc892fc..bfb538bab0cf9c34be8e1f13d3120f51953faf89 100644 (file)
@@ -99,6 +99,7 @@ Standard_Boolean myHasCheck;
 Standard_Integer myNbSolids;
 Standard_Integer myNbBlocks;
 TopTools_SequenceOfShape myPossibleBlocks;
+Standard_Integer myNbDegen;
 Standard_Integer myNbUF;
 Standard_Integer myNbUE;
 Standard_Integer myNbUFUE;