#include <TopoDS_Face.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopExp_Explorer.hxx>
-#include <ShapeUpgrade_UnifySameDomain.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
#include <BRep_Builder.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <QStringList>
}
} // faces iterator
+ // Check the result of fuse operation
if ( !aFuseShape.IsNull() ) {
ShapeUpgrade_UnifySameDomain anUnifier( aFuseShape );
- anUnifier.UnifyFacesAndEdges();
anUnifier.Build();
TopoDS_Shape anUnitedShape = anUnifier.Shape();
- TopExp_Explorer anExp( anUnitedShape, TopAbs_FACE );
- if ( anExp.More() ) {
- aRegionFace = TopoDS::Face( anExp.Current() );
- anExp.Next();
- if ( anExp.More() ) {
- aRegionFace.Nullify();
- }
+ TopTools_IndexedMapOfShape aMapOfFaces;
+ TopExp::MapShapes( anUnitedShape, TopAbs_FACE, aMapOfFaces );
+ if ( aMapOfFaces.Extent() == 1 ) {
+ aRegionFace = TopoDS::Face( aMapOfFaces(1) );
}
}
}