From a3dc0f3c0c12e9cd940410a779516fd06d644cfc Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 28 Jun 2013 14:01:54 +0000 Subject: [PATCH] Posting of RemoverWebs (RemoveInternalFaces functionality) to the new BOP. Done by MALTCHIKOV Eugeny. --- src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx | 71 ++++++++++++------------- src/GEOMAlgo/GEOMAlgo_RemoverWebs.hxx | 13 +++-- src/GEOMAlgo/Makefile.am | 2 + src/GEOMImpl/GEOMImpl_HealingDriver.cxx | 6 +-- src/GEOM_SWIG/GEOM_TestHealing.py | 2 +- 5 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx index b8603b056..4d446271c 100644 --- a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx +++ b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,30 +22,25 @@ // File: GEOMAlgo_RemoverWebs.cxx // Created: Thu Mar 28 07:40:32 2013 // Author: Peter KURNEV -// -// + #include +#include #include #include #include #include -#include -#include -#include -#include - #include #include -#include +#include -#include -#include -#include +#include +#include +#include //======================================================================= //function : @@ -106,7 +101,7 @@ void GEOMAlgo_RemoverWebs::Perform() if (!myContext.IsNull()) { myContext.Nullify(); } - myContext=new IntTools_Context; + myContext=new BOPInt_Context; // BuildSolid(); // @@ -122,16 +117,16 @@ void GEOMAlgo_RemoverWebs::BuildSolid() TopAbs_Orientation aOr; TopoDS_Iterator aIt1, aIt2; BRep_Builder aBB; - TopTools_IndexedMapOfShape aMSI; - TopTools_IndexedDataMapOfShapeListOfShape aMFS; - TopTools_ListOfShape aSFS; - TopTools_ListIteratorOfListOfShape aItLS; - GEOMAlgo_BuilderSolid aSB; + BOPCol_IndexedMapOfShape aMSI; + BOPCol_IndexedDataMapOfShapeListOfShape aMFS; + BOPCol_ListOfShape aSFS; + BOPCol_ListIteratorOfListOfShape aItLS; + BOPAlgo_BuilderSolid aSB; // aNbF2=0; // // 1. aSFS: Faces - TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); + BOPTools::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); // aNbF=aMFS.Extent(); for (i=1; i<=aNbF; ++i) { @@ -147,13 +142,13 @@ void GEOMAlgo_RemoverWebs::BuildSolid() aSFS.Append(aFi); } else { - const TopTools_ListOfShape& aLSx=aMFS(i); + const BOPCol_ListOfShape& aLSx=aMFS(i); aNbSx=aLSx.Extent(); if (aNbSx==1) { - aSFS.Append(aFx); + aSFS.Append(aFx); } else if (aNbSx==2) { - ++aNbF2; + ++aNbF2; } } } @@ -172,17 +167,17 @@ void GEOMAlgo_RemoverWebs::BuildSolid() for (; aIt2.More(); aIt2.Next()) { const TopoDS_Shape& aSi=aIt2.Value(); if (aSi.ShapeType()!=TopAbs_SHELL) { - aOr=aSi.Orientation(); - if (aOr==TopAbs_INTERNAL) { - aMSI.Add(aSi); - } + aOr=aSi.Orientation(); + if (aOr==TopAbs_INTERNAL) { + aMSI.Add(aSi); + } } } } aNbSI=aMSI.Extent(); // // 3 Solids without internals - GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, myResult); + BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, myResult); // aSB.SetContext(myContext); aSB.SetShapes(aSFS); @@ -193,7 +188,7 @@ void GEOMAlgo_RemoverWebs::BuildSolid() return; } // - const TopTools_ListOfShape& aLSR=aSB.Areas(); + const BOPCol_ListOfShape& aLSR=aSB.Areas(); // // 4 Add the internals if (aNbSI) { @@ -211,17 +206,17 @@ void GEOMAlgo_RemoverWebs::BuildSolid() //function : AddInternalShapes //purpose : //======================================================================= -void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR, - const TopTools_IndexedMapOfShape& aMSI) +void GEOMAlgo_RemoverWebs::AddInternalShapes(const BOPCol_ListOfShape& aLSR, + const BOPCol_IndexedMapOfShape& aMSI) { Standard_Integer i, aNbSI; TopAbs_State aState; TopoDS_Solid aSd; BRep_Builder aBB; - TopTools_ListIteratorOfListOfShape aItLS; - Handle(IntTools_Context) aCtx; + BOPCol_ListIteratorOfListOfShape aItLS; + Handle(BOPInt_Context) aCtx; // - aCtx=new IntTools_Context; + aCtx=new BOPInt_Context; // aNbSI=aMSI.Extent(); for (i=1; i<=aNbSI; ++i) { @@ -231,12 +226,12 @@ void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR, for (; aItLS.More(); aItLS.Next()) { aSd=*((TopoDS_Solid*)&aItLS.Value()); // - aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx); + aState=BOPTools_AlgoTools::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx); if (aState==TopAbs_IN) { - aBB.Add(aSd, aSI); - // - BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSd); - aSC.Load(aSd); + aBB.Add(aSd, aSI); + // + BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSd); + aSC.Load(aSd); } } } diff --git a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.hxx b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.hxx index 575a5fdcf..2caa1198c 100644 --- a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.hxx +++ b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,8 +22,7 @@ // File: GEOMAlgo_RemoverWebs.hxx // Created: Thu Mar 28 08:02:59 2013 // Author: Peter KURNEV -// -// + // The algorithm is intended to build result [solid(s)] // from given set of solids [argument]. // The result cosists of: @@ -39,8 +38,8 @@ #include // #include -#include -#include +#include +#include //======================================================================= //function : GEOMAlgo_RemoverWebs @@ -67,8 +66,8 @@ protected: void BuildSolid() ; Standard_EXPORT - static void AddInternalShapes(const TopTools_ListOfShape& , - const TopTools_IndexedMapOfShape& ); + static void AddInternalShapes(const BOPCol_ListOfShape& , + const BOPCol_IndexedMapOfShape& ); // }; diff --git a/src/GEOMAlgo/Makefile.am b/src/GEOMAlgo/Makefile.am index bfa16326e..2da6a26c4 100644 --- a/src/GEOMAlgo/Makefile.am +++ b/src/GEOMAlgo/Makefile.am @@ -61,6 +61,7 @@ dist_libGEOMAlgo_la_SOURCES = \ GEOMAlgo_PassKeyMapHasher.cxx \ GEOMAlgo_PassKeyShape.cxx \ GEOMAlgo_PassKeyShapeMapHasher.cxx \ + GEOMAlgo_RemoverWebs.cxx \ GEOMAlgo_ShapeAlgo.cxx \ GEOMAlgo_ShapeInfo.cxx \ GEOMAlgo_ShapeInfoFiller.cxx \ @@ -121,6 +122,7 @@ salomeinclude_HEADERS = \ GEOMAlgo_PassKeyMapHasher.hxx \ GEOMAlgo_PassKeyShape.hxx \ GEOMAlgo_PassKeyShapeMapHasher.hxx \ + GEOMAlgo_RemoverWebs.hxx \ GEOMAlgo_ShapeAlgo.hxx \ GEOMAlgo_ShapeInfo.hxx \ GEOMAlgo_ShapeInfoFiller.hxx \ diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 63ee616af..7010b0e33 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -31,7 +31,7 @@ #include #include -//#include +#include #include #include @@ -454,7 +454,7 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI, Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape, TopoDS_Shape& theOutShape) const { - /* GEOMAlgo_RemoverWebs aTool; + GEOMAlgo_RemoverWebs aTool; aTool.SetShape(theOriginalShape); aTool.Perform(); @@ -472,8 +472,6 @@ Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape } return Standard_True; - */ - return Standard_False; } //======================================================================= diff --git a/src/GEOM_SWIG/GEOM_TestHealing.py b/src/GEOM_SWIG/GEOM_TestHealing.py index 8e0918724..9d711ed68 100644 --- a/src/GEOM_SWIG/GEOM_TestHealing.py +++ b/src/GEOM_SWIG/GEOM_TestHealing.py @@ -397,4 +397,4 @@ def TestHealingOperations (geompy, math): TestSuppressFaces(geompy) TestProcessShape(geompy) TestFuseEdges(geompy) - #TestRemoveWebs(geompy) + TestRemoveWebs(geompy) -- 2.39.2