Complete implementation of BlocksOperations.CheckAndImprove() method

This commit is contained in:
jfa 2004-12-30 07:55:59 +00:00
parent b940d97c7d
commit 4603044419
3 changed files with 48 additions and 9 deletions

View File

@ -10,6 +10,8 @@ using namespace std;
#include "GEOMImpl_Types.hxx" #include "GEOMImpl_Types.hxx"
#include "GEOMImpl_ILocalOperations.hxx" #include "GEOMImpl_ILocalOperations.hxx"
#include "GEOMImpl_Block6Explorer.hxx" #include "GEOMImpl_Block6Explorer.hxx"
#include "GEOMImpl_IBlocksOperations.hxx"
#include "GEOM_Function.hxx" #include "GEOM_Function.hxx"
#include "ShHealOper_Sewing.hxx" #include "ShHealOper_Sewing.hxx"
@ -471,19 +473,51 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
Standard_NullObject::Raise("Null Shape given"); Standard_NullObject::Raise("Null Shape given");
} }
if (aType == BLOCK_REMOVE_EXTRA) { // 1. Improve solids with seam and/or degenerated edges
BlockFix_BlockFixAPI aTool; BlockFix_BlockFixAPI aTool;
//aTool.Tolerance() = toler; //aTool.Tolerance() = toler;
aTool.SetShape(aBlockOrComp); aTool.SetShape(aBlockOrComp);
aTool.Perform(); aTool.Perform();
if (aType == BLOCK_REMOVE_EXTRA) {
aShape = aTool.Shape(); aShape = aTool.Shape();
if (aShape == aBlockOrComp) { if (aShape == aBlockOrComp) {
MESSAGE("No modifications have been done"); MESSAGE("No modifications have been done");
} }
} else { // aType == BLOCK_COMPOUND_IMPROVE } 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 || } else if (aType == BLOCK_MULTI_TRANSFORM_1D ||

View File

@ -1660,7 +1660,7 @@ Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks
* Set of functions, used by CheckCompoundOfBlocks() method * Set of functions, used by CheckCompoundOfBlocks() method
*/ */
//============================================================================= //=============================================================================
void AddBlocksFrom (const TopoDS_Shape& theShape, void GEOMImpl_IBlocksOperations::AddBlocksFrom (const TopoDS_Shape& theShape,
TopTools_ListOfShape& BLO, TopTools_ListOfShape& BLO,
TopTools_ListOfShape& NOT, TopTools_ListOfShape& NOT,
TopTools_ListOfShape& EXT) TopTools_ListOfShape& EXT)

View File

@ -109,6 +109,11 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound); 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 // Extract blocks from blocks compounds
Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
(Handle(GEOM_Object) theCompound, (Handle(GEOM_Object) theCompound,