From 460304441933dceab260d4f2e5df1821717b9f67 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 30 Dec 2004 07:55:59 +0000 Subject: [PATCH] Complete implementation of BlocksOperations.CheckAndImprove() method --- src/GEOMImpl/GEOMImpl_BlockDriver.cxx | 44 ++++++++++++++++++--- src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx | 8 ++-- src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx | 5 +++ 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 083b6a0ae..cad20102e 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -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 || diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 6921da79b..9c9409a08 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -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) { diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx index 2312928d7..9c7010594 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx @@ -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, -- 2.39.2