Change the type of the field BOPAlgo_Builder::myOrigins so that the new shape could have multiple origins in case of overlapping.
* The result of Boolean operations on arguments of collection types (WIRE/SHELL/COMPSOLID) is now filtered from duplicating containers.
+@subsection upgrade_720_changes_methods Other changes
+
+* The method BOPAlgo_Builder::Origins() returns BOPCol_DataMapOfShapeListOfShape instead of BOPCol_DataMapOfShapeShape.
+
@subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices
* The classes *BOPDS_PassKey* and *BOPDS_PassKeyBoolean* are too excessive and not used any more in Boolean Operations. To replace them the new *BOPDS_Pair* class has been implemented. Thus:
//function : Origins
//purpose :
//=======================================================================
-const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::Origins()const
+const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Origins()const
{
return myOrigins;
}
Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const;
//! Returns myOrigins.
- Standard_EXPORT const BOPCol_DataMapOfShapeShape& Origins() const;
+ Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Origins() const;
//! Returns myShapesSD.
Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const;
BOPCol_DataMapOfShapeListOfShape myImages;
BOPCol_DataMapOfShapeShape myShapesSD;
BOPCol_DataMapOfShapeListOfShape mySplits;
- BOPCol_DataMapOfShapeShape myOrigins;
+ BOPCol_DataMapOfShapeListOfShape myOrigins;
Standard_Boolean myNonDestructive;
BOPAlgo_GlueEnum myGlue;
//function : FillImagesVertices
//purpose :
//=======================================================================
- void BOPAlgo_Builder::FillImagesVertices()
+void BOPAlgo_Builder::FillImagesVertices()
{
myErrorStatus=0;
//
myImages.Bind(aV, aLVSD);
//
myShapesSD.Bind(aV, aVSD);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aVSD);
+ if (!pLOr) {
+ pLOr = myOrigins.Bound(aVSD, BOPCol_ListOfShape());
+ }
+ pLOr->Append(aV);
}
}
//=======================================================================
Standard_Integer nSpR = aPBR->Edge();
const TopoDS_Shape& aSpR = myDS->Shape(nSpR);
pLS->Append(aSpR);
- myOrigins.Bind(aSpR, aE);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSpR);
+ if (!pLOr) {
+ pLOr = myOrigins.Bound(aSpR, BOPCol_ListOfShape());
+ }
+ pLOr->Append(aE);
//
if (myDS->IsCommonBlockOnEdge(aPB)) {
Standard_Integer nSp = aPB->Edge();
aItLS.Initialize(aLFIm);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
- myOrigins.Bind(aFSp, aF);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aFSp);
+ if (!pLOr) {
+ pLOr = myOrigins.Bound(aFSp, BOPCol_ListOfShape());
+ }
+ pLOr->Append(aF);
}
//
// 3.
const BOPCol_ListOfShape& aLSR=aBS.Areas();
//
if (!myImages.IsBound(aS)) {
- BOPCol_ListOfShape aLSx;
- //
- myImages.Bind(aS, aLSx);
- BOPCol_ListOfShape& aLSIm=myImages.ChangeFind(aS);
+ BOPCol_ListOfShape* pLSx = myImages.Bound(aS, BOPCol_ListOfShape());
//
aIt.Initialize(aLSR);
for (; aIt.More(); aIt.Next()) {
//
const BOPTools_Set& aSTx=aMST.Added(aST);
const TopoDS_Shape& aSx=aSTx.Shape();
- aLSIm.Append(aSx);
+ pLSx->Append(aSx);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSx);
+ if (!pLOr) {
+ pLOr = myOrigins.Bound(aSx, BOPCol_ListOfShape());
+ }
+ pLOr->Append(aS);
//
if (bFlagSD) {
myShapesSD.Bind(aSR, aSx);
continue;
}
//
- if(aMSOr.Contains(aSd)) {
- //
+ if (aMSOr.Contains(aSd)) {
+ // make new solid
TopoDS_Solid aSdx;
//
aBB.MakeSolid(aSdx);
//
aBB.Add(aSdx, aSI);
//
- if (myImages.IsBound(aSdx)) {
- BOPCol_ListOfShape& aLS=myImages.ChangeFind(aSdx);
- aLS.Append(aSdx);
- }
- else {
- BOPCol_ListOfShape aLS;
- aLS.Append(aSdx);
- myImages.Bind(aSd, aLS);
- }
+ // no need to check for images of aSd as aMSOr contains only original solids
+ BOPCol_ListOfShape* pLS = myImages.Bound(aSd, BOPCol_ListOfShape());
+ pLS->Append(aSdx);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.Bound(aSdx, BOPCol_ListOfShape());
+ pLOr->Append(aSd);
//
aMSOr.Remove(aSd);
aSd=aSdx;
return 0;
}
//
- char buf[32];
- //
BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
- const BOPCol_DataMapOfShapeShape& aDMI = aBuilder.Origins();
+ const BOPCol_DataMapOfShapeListOfShape& aDMI = aBuilder.Origins();
if (!aDMI.IsBound(aS)) {
di << " no origins found\n";
return 0;
}
//
- const TopoDS_Shape& aSx = aDMI.Find(aS);
- //
+ char buf[32];
sprintf(buf, "%s_or", a[1]);
- DBRep::Set(buf, aSx);
//
+ const BOPCol_ListOfShape& aLSx = aDMI.Find(aS);
+ if (aLSx.Extent() == 1) {
+ DBRep::Set(buf, aLSx.First());
+ di << "1 origin found\n" << buf << "\n";
+ return 0;
+ }
+ //
+ TopoDS_Compound aCOr;
+ BRep_Builder().MakeCompound(aCOr);
+ //
+ BOPCol_ListIteratorOfListOfShape aItLSx(aLSx);
+ for (; aItLSx.More(); aItLSx.Next()) {
+ BRep_Builder().Add(aCOr, aItLSx.Value());
+ }
+ //
+ DBRep::Set(buf, aCOr);
+ //
+ di << aLSx.Extent() << " origins found\n";
di << buf << "\n";
//
return 0;
aSx=aSTx.Shape();
aSx.Orientation(anOriF);
aLFIm.Append(aSx);
- myOrigins.Bind(aSx, aF);
+ //
+ BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSx);
+ if (!pLOr) {
+ pLOr = myOrigins.Bound(aSx, BOPCol_ListOfShape());
+ }
+ pLOr->Append(aF);
//
if (bFlagSD) {
myShapesSD.Bind(aFR, aSx);
--- /dev/null
+puts "========"
+puts "OCC28776"
+puts "========"
+puts ""
+####################################################################
+# Extend the field BOPAlgo_Builder::myOrigins so that the shape could have multiple origins
+####################################################################
+
+box b1 10 10 10
+box b2 10 10 10
+box b3 10 10 10
+
+bclearobjects
+bcleartools
+baddobjects b1 b2 b3
+bfillds
+bbuild r
+
+explode r v
+boporigin r_1
+checknbshapes r_1_or -vertex 3
+
+explode r e
+boporigin r_1
+checknbshapes r_1_or -edge 3
+
+explode r f
+boporigin r_1
+checknbshapes r_1_or -face 3
+
+explode r so
+boporigin r_1
+checknbshapes r_1_or -solid 3
+