#include <Bnd_Box.hxx>
#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
#include <BRepAlgo.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
-#include <TopOpeBRepBuild_HBuilder.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:30:25 2002 f
-//#include <BRepAlgo_Cut.hxx>
-//#include <BRepAlgo_Fuse.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:30:29 2002 t
#ifdef OCCT_DEBUG
extern Standard_Boolean BRepFeat_GettraceFEAT();
#endif
#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << "BRepFeat_Form::GlobalPerform ()" << endl;
+ if (trc) std::cout << "BRepFeat_Form::GlobalPerform ()" << std::endl;
#endif
if (!mySbOK || !myGSOK || !mySFOK || !mySUOK || !myGFOK ||
!mySkOK || !myPSOK) {
#ifdef OCCT_DEBUG
- if (trc) cout << " Fields not initialized in BRepFeat_Form" << endl;
+ if (trc) std::cout << " Fields not initialized in BRepFeat_Form" << std::endl;
#endif
myStatusError = BRepFeat_NotInitialized;
NotDone();
if(myJustFeat && !myFuse) {
#ifdef OCCT_DEBUG
- if (trc) cout << " Invalid option : myJustFeat + Cut" << endl;
+ if (trc) std::cout << " Invalid option : myJustFeat + Cut" << std::endl;
#endif
myStatusError = BRepFeat_InvOption;
NotDone();
if (!exp.More()) {
FromInShape = Standard_False;
#ifdef OCCT_DEBUG
- if (trc) cout << " From not in Shape" << endl;
+ if (trc) std::cout << " From not in Shape" << std::endl;
#endif
break;
}
if (!exp.More()) {
UntilInShape = Standard_False;
#ifdef OCCT_DEBUG
- if (trc) cout << " Until not in Shape" << endl;
+ if (trc) std::cout << " Until not in Shape" << std::endl;
#endif
break;
}
if (theOpe == 1) {
#ifdef OCCT_DEBUG
- if (trc) cout << " Gluer" << endl;
+ if (trc) std::cout << " Gluer" << std::endl;
#endif
Standard_Boolean Collage = Standard_True;
// cut by FFrom && FUntil
TopTools_DataMapOfShapeListOfShape locmap;
TopExp_Explorer expp(Comp, TopAbs_SOLID);
if(expp.More() && !Comp.IsNull() && !myGShape.IsNull()) {
- //modified by NIZNHY-PKV Thu Mar 21 17:15:36 2002 f
- //BRepAlgo_Cut trP(myGShape,Comp);
BRepAlgoAPI_Cut trP(myGShape, Comp);
- //modified by NIZNHY-PKV Thu Mar 21 17:15:58 2002 t
exp.Init(trP.Shape(), TopAbs_SOLID);
if (exp.Current().IsNull()) {
theOpe = 2;
else {// else X0
// Only solids are preserved
TopoDS_Shape theGShape;
- BRep_Builder B;
B.MakeCompound(TopoDS::Compound(theGShape));
for (; exp.More(); exp.Next()) {
B.Add(theGShape,exp.Current());
}
}// if(!mySUntil.IsNull())
//
- //modified by NIZNHY-PKV Thu Mar 21 17:21:49 2002 f
- //UpdateDescendants(trP.Builder(),theGShape,Standard_True); // skip faces
UpdateDescendants(trP,theGShape,Standard_True); // skip faces
- //modified by NIZNHY-PKV Thu Mar 21 17:22:32 2002 t
theGlue.Init(mySbase,theGShape);
for (itm.Initialize(myGluedF);itm.More();itm.Next()) {
if (theOpe == 1) {
#ifdef OCCT_DEBUG
- if (trc) cout << " still Gluer" << endl;
+ if (trc) std::cout << " still Gluer" << std::endl;
#endif
theGlue.Perform();
if (theGlue.IsDone()) {
myNewEdges = theGlue.Edges();
myTgtEdges = theGlue.TgtEdges();
#ifdef OCCT_DEBUG
- if (trc) cout << " Gluer result" << endl;
+ if (trc) std::cout << " Gluer result" << std::endl;
#endif
Done();
myShape = theGlue.ResultingShape();
if (theOpe == 2 && ChangeOpe && myJustGluer) {
#ifdef OCCT_DEBUG
- if (trc) cout << " Gluer failure" << endl;
+ if (trc) std::cout << " Gluer failure" << std::endl;
#endif
myJustGluer = Standard_False;
theOpe = 0;
if (theOpe == 2) {
#ifdef OCCT_DEBUG
- if (trc) cout << " No Gluer" << endl;
+ if (trc) std::cout << " No Gluer" << std::endl;
#endif
TopoDS_Shape theGShape = myGShape;
if (ChangeOpe) {
#ifdef OCCT_DEBUG
- if (trc) cout << " Passage to topological operations" << endl;
+ if (trc) std::cout << " Passage to topological operations" << std::endl;
#endif
}
TopExp_Explorer expp(Comp, TopAbs_SOLID);
if(expp.More() && !Comp.IsNull() && !myGShape.IsNull()) {
- //modified by NIZNHY-PKV Thu Mar 21 17:24:52 2002 f
- //BRepAlgo_Cut trP(myGShape,Comp);
BRepAlgoAPI_Cut trP(myGShape, Comp);
- //modified by NIZNHY-PKV Thu Mar 21 17:24:56 2002 t
// the result is necessarily a compound.
exp.Init(trP.Shape(),TopAbs_SOLID);
if (!exp.More()) {
}
// Only solids are preserved
theGShape.Nullify();
- BRep_Builder B;
B.MakeCompound(TopoDS::Compound(theGShape));
for (; exp.More(); exp.Next()) {
B.Add(theGShape,exp.Current());
}
}
}
- //modified by NIZNHY-PKV Thu Mar 21 17:27:23 2002 f
- //UpdateDescendants(trP.Builder(),theGShape,Standard_True);
UpdateDescendants(trP,theGShape,Standard_True);
- //modified by NIZNHY-PKV Thu Mar 21 17:27:31 2002 t
}//if(expp.More() && !Comp.IsNull() && !myGShape.IsNull()) {
//
// Case when no part of the tool is preserved
if (!KeepParts) {
#ifdef OCCT_DEBUG
- if (trc) cout << " No parts of tool kept" << endl;
+ if (trc) std::cout << " No parts of tool kept" << std::endl;
#endif
myStatusError = BRepFeat_NoParts;
NotDone();
Standard_Real min, max, pmin, pmax;
Standard_Boolean flag2;
TopoDS_Shape Compo;
- BRep_Builder B;
B.MakeCompound(TopoDS::Compound(Compo));
for (it.Initialize(lshape); it.More(); it.Next()) {
BRepFeat::ParametricMinMax(it.Value(),C,
if (!myJustFeat) {
// removal of edges of section that have no common vertices
// with PartsOfTool preserved
- //modified by NIZHNY-EMV Thu May 10 15:56:24 2012
if (bFlag) {
theBuilder.PerformResult();
myShape = theBuilder.Shape();
} else {
myShape = theBuilder.Shape();
}
- //modified by NIZHNY-EMV Thu May 10 15:56:26 2012
Done();
}
else {
Standard_Boolean BRepFeat_Form::IsDeleted(const TopoDS_Shape& F)
{
- return (myMap(F).IsEmpty());
+ if (myMap.IsBound(F))
+ {
+ return (myMap(F).IsEmpty());
+ }
+ return Standard_False;
}
//=======================================================================
const TopTools_ListOfShape& BRepFeat_Form::Modified
(const TopoDS_Shape& F)
{
+ myGenerated.Clear();
+ if (!IsDone())
+ return myGenerated;
+
+ if (mySbase.IsEqual(F))
+ {
+ myGenerated.Append(myShape);
+ return myGenerated;
+ }
+
if (myMap.IsBound(F)) {
- static TopTools_ListOfShape list;
- list.Clear(); // For the second passage DPF
TopTools_ListIteratorOfListOfShape ite(myMap(F));
for(; ite.More(); ite.Next()) {
const TopoDS_Shape& sh = ite.Value();
- if(!sh.IsSame(F))
- list.Append(sh);
+ if(!sh.IsSame(F) && sh.ShapeType() == F.ShapeType())
+ myGenerated.Append(sh);
}
- return list;
}
return myGenerated; // empty list
}
const TopTools_ListOfShape& BRepFeat_Form::Generated
(const TopoDS_Shape& S)
{
- if (myMap.IsBound(S) &&
- S.ShapeType() != TopAbs_FACE) { // check if filter on face or not
- static TopTools_ListOfShape list;
- list.Clear(); // For the second passage DPF
+ myGenerated.Clear();
+ if (!IsDone())
+ return myGenerated;
+ if (myMap.IsBound(S) &&
+ S.ShapeType() != TopAbs_FACE) { // check if filter on face or not
TopTools_ListIteratorOfListOfShape ite(myMap(S));
for(; ite.More(); ite.Next()) {
const TopoDS_Shape& sh = ite.Value();
if(!sh.IsSame(S))
- list.Append(sh);
+ myGenerated.Append(sh);
}
- return list;
+ return myGenerated;
}
- else return myGenerated;
+ return myGenerated;
}
TopExp_Explorer exp(shapefu, TopAbs_FACE);
if (!exp.More()) { // no faces... It is necessary to return an error
#ifdef OCCT_DEBUG
- if (trc) cout << " BRepFeat_Form::TransformShapeFU : invalid Shape" << endl;
+ if (trc) std::cout << " BRepFeat_Form::TransformShapeFU : invalid Shape" << std::endl;
#endif
return Trf;
}
}
#ifdef OCCT_DEBUG
if (trc) {
- if (Trf && (flag == 0)) cout << " TransformShapeFU From" << endl;
- if (Trf && (flag == 1)) cout << " TransformShapeFU Until" << endl;
+ if (Trf && (flag == 0)) std::cout << " TransformShapeFU From" << std::endl;
+ if (Trf && (flag == 1)) std::cout << " TransformShapeFU Until" << std::endl;
}
#endif
return Trf;
}
}
-//=======================================================================
-//function : UpdateDescendants
-//purpose :
-//=======================================================================
- void BRepFeat_Form::UpdateDescendants(const Handle(TopOpeBRepBuild_HBuilder)& B,
- const TopoDS_Shape& S,
- const Standard_Boolean SkipFace)
-{
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itdm;
- TopTools_ListIteratorOfListOfShape it,it2;
- TopTools_MapIteratorOfMapOfShape itm;
- TopExp_Explorer exp;
-
- for (itdm.Initialize(myMap);itdm.More();itdm.Next()) {
- const TopoDS_Shape& orig = itdm.Key();
- if (SkipFace && orig.ShapeType() == TopAbs_FACE) {
- continue;
- }
- TopTools_MapOfShape newdsc;
-
- if (itdm.Value().IsEmpty()) {myMap.ChangeFind(orig).Append(orig);}
-
- for (it.Initialize(itdm.Value());it.More();it.Next()) {
- const TopoDS_Shape& sh = it.Value();
- if(sh.ShapeType() != TopAbs_FACE) continue;
- const TopoDS_Face& fdsc = TopoDS::Face(it.Value());
- for (exp.Init(S,TopAbs_FACE);exp.More();exp.Next()) {
- if (exp.Current().IsSame(fdsc)) { // preserved
- newdsc.Add(fdsc);
- break;
- }
- }
- if (!exp.More()) {
- if (B->IsSplit(fdsc, TopAbs_OUT)) {
- for (it2.Initialize(B->Splits(fdsc,TopAbs_OUT));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- if (B->IsSplit(fdsc, TopAbs_IN)) {
- for (it2.Initialize(B->Splits(fdsc,TopAbs_IN));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- if (B->IsSplit(fdsc, TopAbs_ON)) {
- for (it2.Initialize(B->Splits(fdsc,TopAbs_ON));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- if (B->IsMerged(fdsc, TopAbs_OUT)) {
- for (it2.Initialize(B->Merged(fdsc,TopAbs_OUT));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- if (B->IsMerged(fdsc, TopAbs_IN)) {
- for (it2.Initialize(B->Merged(fdsc,TopAbs_IN));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- if (B->IsMerged(fdsc, TopAbs_ON)) {
- for (it2.Initialize(B->Merged(fdsc,TopAbs_ON));
- it2.More();it2.Next()) {
- newdsc.Add(it2.Value());
- }
- }
- }
- }
- myMap.ChangeFind(orig).Clear();
- for (itm.Initialize(newdsc); itm.More(); itm.Next()) {
- // check the appartenance to the shape...
- for (exp.Init(S,TopAbs_FACE);exp.More();exp.Next()) {
- if (exp.Current().IsSame(itm.Key())) {
-// const TopoDS_Shape& sh = itm.Key();
- myMap.ChangeFind(orig).Append(itm.Key());
- break;
- }
- }
- }
- }
-}
-//modified by NIZNHY-PKV Thu Mar 21 18:43:18 2002 f
//=======================================================================
//function : UpdateDescendants
//purpose :
}
}
}
-//modified by NIZNHY-PKV Thu Mar 21 18:43:36 2002 t