#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_ILocalOperations.hxx"
#include "GEOMImpl_Block6Explorer.hxx"
+#include "GEOMImpl_IBlocksOperations.hxx"
+
#include "GEOM_Function.hxx"
#include "ShHealOper_Sewing.hxx"
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) {
}
} 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 ||
* 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) {
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,