BB.MakeCompound(aToolCmp);
for (int i=1; i<= EdgesTools.Extent();i++)
BB.Add(aToolCmp, EdgesTools(i));
- //
+
+ TopoDS_Compound aObjCmp;
+ BB.MakeCompound(aObjCmp);
for (int i = 1; i <= ObjToRes.Extent(); i++ )
{
const TopoDS_Shape& Obj = ObjToRes.FindKey(i);
- Standard_Real aTol;
- if (!Obj.IsNull())
- {
- aTol = Precision::Confusion();
- BOPAlgo_BOP aBOP;
- //
- aBOP.AddArgument(Obj);
- aBOP.AddTool(aToolCmp);
- aBOP.SetOperation(BOPAlgo_CUT);
- aBOP.SetRunParallel(true);
+ if (!Obj.IsNull())
+ BB.Add(aObjCmp, Obj);
+ }
+
+ Standard_Real aTol;
+
+ aTol = Precision::Confusion();
+ BOPAlgo_BOP aBOP;
+ //
+ aBOP.AddArgument(aObjCmp);
+ aBOP.AddTool(aToolCmp);
+ aBOP.SetOperation(BOPAlgo_FUSE);
+ aBOP.SetRunParallel(true);
- aBOP.Perform();
+ aBOP.Perform();
#if OCC_VERSION_LARGE > 0x07020000
if (aBOP.HasErrors())
return false;
#endif
- const TopoDS_Shape& aRes=aBOP.Shape();
+ for (int i = 1; i <= ObjToRes.Extent(); i++ )
+ {
+ const TopoDS_Shape& Obj = ObjToRes.FindKey(i);
+ Standard_Real aTol;
+ if (!Obj.IsNull())
+ {
+ TopTools_ListOfShape ls = aBOP.Modified(Obj);
+ TopoDS_Shape aRes;
+ if (ls.IsEmpty())
+ aRes = Obj; //no fusing of toolcmp with Obj
+ else if (ls.Extent() == 1)
+ aRes = ls.First();
+ else
+ {
+ BRep_Builder BB;
+ TopoDS_Compound cmp;
+ BB.MakeCompound(cmp);
+ TopTools_ListIteratorOfListOfShape aItLS(ls);
+ for (; aItLS.More(); aItLS.Next())
+ BB.Add(cmp, aItLS.Value());
+ aRes = cmp;
+ }
+ //const TopoDS_Shape& aRes=aBOP.Shape();
ObjToRes.ChangeFromKey(Obj) = aRes;
}
}
+
return true;
}