]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Complete implementation of BlocksOperations.CheckAndImprove() method
authorjfa <jfa@opencascade.com>
Thu, 30 Dec 2004 07:55:59 +0000 (07:55 +0000)
committerjfa <jfa@opencascade.com>
Thu, 30 Dec 2004 07:55:59 +0000 (07:55 +0000)
src/GEOMImpl/GEOMImpl_BlockDriver.cxx
src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx

index 083b6a0ae16e450d4ffc86ec8c34a05396e3d5d0..cad20102e8295bdea6863e33824cfe63332c19cc 100644 (file)
@@ -10,6 +10,8 @@ using namespace std;
 #include "GEOMImpl_Types.hxx"
 #include "GEOMImpl_ILocalOperations.hxx"
 #include "GEOMImpl_Block6Explorer.hxx"
+#include "GEOMImpl_IBlocksOperations.hxx"
+
 #include "GEOM_Function.hxx"
 
 #include "ShHealOper_Sewing.hxx"
@@ -471,12 +473,13 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
         Standard_NullObject::Raise("Null Shape given");
       }
 
-      if (aType == BLOCK_REMOVE_EXTRA) {
+      // 1. Improve solids with seam and/or degenerated edges
+      BlockFix_BlockFixAPI aTool;
+      //aTool.Tolerance() = toler;
+      aTool.SetShape(aBlockOrComp);
+      aTool.Perform();
 
-        BlockFix_BlockFixAPI aTool;
-        //aTool.Tolerance() = toler;
-        aTool.SetShape(aBlockOrComp);
-        aTool.Perform();
+      if (aType == BLOCK_REMOVE_EXTRA) {
 
         aShape = aTool.Shape();
         if (aShape == aBlockOrComp) {
@@ -484,6 +487,37 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
         }
 
       } else { // aType == BLOCK_COMPOUND_IMPROVE
+
+        TopoDS_Shape aFixedExtra = aTool.Shape();
+
+        // 2. Separate non-blocks
+        TopTools_ListOfShape BLO; // All blocks from the given compound
+        TopTools_ListOfShape NOT; // Not blocks
+        TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
+        GEOMImpl_IBlocksOperations::AddBlocksFrom(aFixedExtra, BLO, NOT, EXT);
+
+        if (NOT.Extent() > 0) {
+          MESSAGE("Some non-blocks have been removed");
+        }
+
+        // 3. Warn about staying extra-edges
+        if (EXT.Extent() > 0) {
+          MESSAGE("Warning: Not all seam or degenerated edges was removed");
+        }
+
+        // ??? Throw away standalone blocks ???
+
+        // 4. Create compound of all blocks
+        TopoDS_Compound aComp;
+        BRep_Builder BB;
+        BB.MakeCompound(aComp);
+        TopTools_ListIteratorOfListOfShape BLOit (BLO);
+        for (; BLOit.More(); BLOit.Next()) {
+          BB.Add(aComp, BLOit.Value());
+        }
+
+        // 5. Glue Faces
+        aShape = GEOMImpl_GlueDriver::GlueFaces(aComp, Precision::Confusion());
       }
 
     } else if (aType == BLOCK_MULTI_TRANSFORM_1D ||
index 6921da79babbb5fca6ab3c21a9377cba7128b2b0..9c9409a08a16cd0699a734a257198e3988f6d73f 100644 (file)
@@ -1660,10 +1660,10 @@ Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks
  *  Set of functions, used by CheckCompoundOfBlocks() method
  */
 //=============================================================================
-void AddBlocksFrom (const TopoDS_Shape&  theShape,
-                    TopTools_ListOfShape& BLO,
-                    TopTools_ListOfShape& NOT,
-                    TopTools_ListOfShape& EXT)
+void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape&   theShape,
+                                                TopTools_ListOfShape& BLO,
+                                                TopTools_ListOfShape& NOT,
+                                                TopTools_ListOfShape& EXT)
 {
   TopAbs_ShapeEnum aType = theShape.ShapeType();
   switch (aType) {
index 2312928d7291f4e10935a74b81d08cf32bfc9823..9c7010594e18fbc389474af8a5541b4ad7fea340 100644 (file)
@@ -109,6 +109,11 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
 
   Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound);
 
+  static void AddBlocksFrom (const TopoDS_Shape&   theShape,
+                             TopTools_ListOfShape& BLO,
+                             TopTools_ListOfShape& NOT,
+                             TopTools_ListOfShape& EXT);
+
   // Extract blocks from blocks compounds
   Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
                                       (Handle(GEOM_Object)    theCompound,