#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
//
+#include <Bnd_Box.hxx>
+//
+#include <BRepBndLib.hxx>
+//
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
void BOPAlgo_BuilderFace::PerformAreas()
{
Standard_Boolean bIsGrowth, bIsHole;
- Standard_Integer k, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;;
+ Standard_Integer k, aNbS, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;
Standard_Real aTol;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
myErrorStatus=0;
+ aNbHoles=0;
//
aTol=BRep_Tool::Tolerance(myFace);
aS=BRep_Tool::Surface(myFace, aLoc);
bIsHole=aClsf.IsHole();
if (bIsHole) {
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
- //
- bIsHole=Standard_True;
+ //
+ bIsHole=Standard_True;
}
else {
bIsHole=Standard_False;
if (bIsHole) {
const Bnd_Box2d& aBox2D=aSB2D.Box2D();
aTreeFiller.Add(k, aBox2D);
+ ++aNbHoles;
}
}
//
aSelector.Clear();
aSelector.SetBox(aBox2DF);
//
- aNbHoles=aBBTree.Select(aSelector);
+ aNbS = aBBTree.Select(aSelector);
+ if (!aNbS) {
+ continue;
+ }
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
}
}// for (m=1; m<=aNbDMISB; ++m)
//
- // 5. Map [Face/Holes] -> aMSH
+ // 5.1 Map [Face/Holes] -> aMSH
aNbInOutMap=aInOutMap.Extent();
for (m=1; m<=aNbInOutMap; ++m) {
const TopoDS_Shape& aHole=aInOutMap.FindKey(m);
}
}
//
+ // 5.2. Add unused holes to the original face
+ if (aNbHoles != aNbInOutMap) {
+ Bnd_Box aBoxF;
+ BRepBndLib::Add(myFace, aBoxF);
+ if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
+ aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
+ aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
+ //
+ BOPCol_ListOfShape anUnUsedHoles;
+ for (m = 1; m <= aNbDMISB; ++m) {
+ const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
+ if (aSB2D.IsHole()) {
+ const TopoDS_Shape& aHole = aSB2D.Shape();
+ if (!aInOutMap.Contains(aHole)) {
+ anUnUsedHoles.Append(aHole);
+ }
+ }
+ }
+ //
+ if (anUnUsedHoles.Extent()) {
+ TopoDS_Face aFace;
+ aBB.MakeFace(aFace, aS, aLoc, aTol);
+ aMSH.Add(aFace, anUnUsedHoles);
+ //
+ BOPAlgo_ShapeBox2D aSB2D;
+ //
+ aSB2D.SetShape(aFace);
+ aSB2D.SetIsHole(Standard_False);
+ //
+ aDMISB.Add(aNbDMISB, aSB2D);
+ ++aNbDMISB;
+ }
+ }
+ }
+ //
// 6. Add aHoles to Faces
aNbMSH=aMSH.Extent();
for (m=1; m<=aNbMSH; ++m) {