Posting of RemoverWebs (RemoveInternalFaces functionality) to the new BOP. Done by MALTCHIKOV Eugeny.

This commit is contained in:
jfa 2013-06-28 14:01:54 +00:00
parent 49277193e7
commit a3dc0f3c0c
5 changed files with 44 additions and 50 deletions

View File

@ -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, // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -22,30 +22,25 @@
// File: GEOMAlgo_RemoverWebs.cxx // File: GEOMAlgo_RemoverWebs.cxx
// Created: Thu Mar 28 07:40:32 2013 // Created: Thu Mar 28 07:40:32 2013
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
//
#include <GEOMAlgo_RemoverWebs.hxx> #include <GEOMAlgo_RemoverWebs.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx> #include <BOPInt_Context.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx> #include <BOPAlgo_BuilderSolid.hxx>
#include <GEOMAlgo_BuilderSolid.hxx>
#include <GEOMAlgo_Tools3D.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
//======================================================================= //=======================================================================
//function : //function :
@ -106,7 +101,7 @@ void GEOMAlgo_RemoverWebs::Perform()
if (!myContext.IsNull()) { if (!myContext.IsNull()) {
myContext.Nullify(); myContext.Nullify();
} }
myContext=new IntTools_Context; myContext=new BOPInt_Context;
// //
BuildSolid(); BuildSolid();
// //
@ -122,16 +117,16 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
TopAbs_Orientation aOr; TopAbs_Orientation aOr;
TopoDS_Iterator aIt1, aIt2; TopoDS_Iterator aIt1, aIt2;
BRep_Builder aBB; BRep_Builder aBB;
TopTools_IndexedMapOfShape aMSI; BOPCol_IndexedMapOfShape aMSI;
TopTools_IndexedDataMapOfShapeListOfShape aMFS; BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
TopTools_ListOfShape aSFS; BOPCol_ListOfShape aSFS;
TopTools_ListIteratorOfListOfShape aItLS; BOPCol_ListIteratorOfListOfShape aItLS;
GEOMAlgo_BuilderSolid aSB; BOPAlgo_BuilderSolid aSB;
// //
aNbF2=0; aNbF2=0;
// //
// 1. aSFS: Faces // 1. aSFS: Faces
TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS); BOPTools::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
// //
aNbF=aMFS.Extent(); aNbF=aMFS.Extent();
for (i=1; i<=aNbF; ++i) { for (i=1; i<=aNbF; ++i) {
@ -147,13 +142,13 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
aSFS.Append(aFi); aSFS.Append(aFi);
} }
else { else {
const TopTools_ListOfShape& aLSx=aMFS(i); const BOPCol_ListOfShape& aLSx=aMFS(i);
aNbSx=aLSx.Extent(); aNbSx=aLSx.Extent();
if (aNbSx==1) { if (aNbSx==1) {
aSFS.Append(aFx); aSFS.Append(aFx);
} }
else if (aNbSx==2) { else if (aNbSx==2) {
++aNbF2; ++aNbF2;
} }
} }
} }
@ -172,17 +167,17 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
for (; aIt2.More(); aIt2.Next()) { for (; aIt2.More(); aIt2.Next()) {
const TopoDS_Shape& aSi=aIt2.Value(); const TopoDS_Shape& aSi=aIt2.Value();
if (aSi.ShapeType()!=TopAbs_SHELL) { if (aSi.ShapeType()!=TopAbs_SHELL) {
aOr=aSi.Orientation(); aOr=aSi.Orientation();
if (aOr==TopAbs_INTERNAL) { if (aOr==TopAbs_INTERNAL) {
aMSI.Add(aSi); aMSI.Add(aSi);
} }
} }
} }
} }
aNbSI=aMSI.Extent(); aNbSI=aMSI.Extent();
// //
// 3 Solids without internals // 3 Solids without internals
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, myResult); BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, myResult);
// //
aSB.SetContext(myContext); aSB.SetContext(myContext);
aSB.SetShapes(aSFS); aSB.SetShapes(aSFS);
@ -193,7 +188,7 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
return; return;
} }
// //
const TopTools_ListOfShape& aLSR=aSB.Areas(); const BOPCol_ListOfShape& aLSR=aSB.Areas();
// //
// 4 Add the internals // 4 Add the internals
if (aNbSI) { if (aNbSI) {
@ -211,17 +206,17 @@ void GEOMAlgo_RemoverWebs::BuildSolid()
//function : AddInternalShapes //function : AddInternalShapes
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR, void GEOMAlgo_RemoverWebs::AddInternalShapes(const BOPCol_ListOfShape& aLSR,
const TopTools_IndexedMapOfShape& aMSI) const BOPCol_IndexedMapOfShape& aMSI)
{ {
Standard_Integer i, aNbSI; Standard_Integer i, aNbSI;
TopAbs_State aState; TopAbs_State aState;
TopoDS_Solid aSd; TopoDS_Solid aSd;
BRep_Builder aBB; BRep_Builder aBB;
TopTools_ListIteratorOfListOfShape aItLS; BOPCol_ListIteratorOfListOfShape aItLS;
Handle(IntTools_Context) aCtx; Handle(BOPInt_Context) aCtx;
// //
aCtx=new IntTools_Context; aCtx=new BOPInt_Context;
// //
aNbSI=aMSI.Extent(); aNbSI=aMSI.Extent();
for (i=1; i<=aNbSI; ++i) { for (i=1; i<=aNbSI; ++i) {
@ -231,12 +226,12 @@ void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR,
for (; aItLS.More(); aItLS.Next()) { for (; aItLS.More(); aItLS.Next()) {
aSd=*((TopoDS_Solid*)&aItLS.Value()); 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) { if (aState==TopAbs_IN) {
aBB.Add(aSd, aSI); aBB.Add(aSd, aSI);
// //
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSd); BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSd);
aSC.Load(aSd); aSC.Load(aSd);
} }
} }
} }

View File

@ -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, // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -22,8 +22,7 @@
// File: GEOMAlgo_RemoverWebs.hxx // File: GEOMAlgo_RemoverWebs.hxx
// Created: Thu Mar 28 08:02:59 2013 // Created: Thu Mar 28 08:02:59 2013
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@petrex>
//
// The algorithm is intended to build result [solid(s)] // The algorithm is intended to build result [solid(s)]
// from given set of solids [argument]. // from given set of solids [argument].
// The result cosists of: // The result cosists of:
@ -39,8 +38,8 @@
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
// //
#include <GEOMAlgo_ShapeAlgo.hxx> #include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopTools_ListOfShape.hxx> #include <BOPCol_ListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <BOPCol_IndexedMapOfShape.hxx>
//======================================================================= //=======================================================================
//function : GEOMAlgo_RemoverWebs //function : GEOMAlgo_RemoverWebs
@ -67,8 +66,8 @@ protected:
void BuildSolid() ; void BuildSolid() ;
Standard_EXPORT Standard_EXPORT
static void AddInternalShapes(const TopTools_ListOfShape& , static void AddInternalShapes(const BOPCol_ListOfShape& ,
const TopTools_IndexedMapOfShape& ); const BOPCol_IndexedMapOfShape& );
// //
}; };

View File

@ -61,6 +61,7 @@ dist_libGEOMAlgo_la_SOURCES = \
GEOMAlgo_PassKeyMapHasher.cxx \ GEOMAlgo_PassKeyMapHasher.cxx \
GEOMAlgo_PassKeyShape.cxx \ GEOMAlgo_PassKeyShape.cxx \
GEOMAlgo_PassKeyShapeMapHasher.cxx \ GEOMAlgo_PassKeyShapeMapHasher.cxx \
GEOMAlgo_RemoverWebs.cxx \
GEOMAlgo_ShapeAlgo.cxx \ GEOMAlgo_ShapeAlgo.cxx \
GEOMAlgo_ShapeInfo.cxx \ GEOMAlgo_ShapeInfo.cxx \
GEOMAlgo_ShapeInfoFiller.cxx \ GEOMAlgo_ShapeInfoFiller.cxx \
@ -121,6 +122,7 @@ salomeinclude_HEADERS = \
GEOMAlgo_PassKeyMapHasher.hxx \ GEOMAlgo_PassKeyMapHasher.hxx \
GEOMAlgo_PassKeyShape.hxx \ GEOMAlgo_PassKeyShape.hxx \
GEOMAlgo_PassKeyShapeMapHasher.hxx \ GEOMAlgo_PassKeyShapeMapHasher.hxx \
GEOMAlgo_RemoverWebs.hxx \
GEOMAlgo_ShapeAlgo.hxx \ GEOMAlgo_ShapeAlgo.hxx \
GEOMAlgo_ShapeInfo.hxx \ GEOMAlgo_ShapeInfo.hxx \
GEOMAlgo_ShapeInfoFiller.hxx \ GEOMAlgo_ShapeInfoFiller.hxx \

View File

@ -31,7 +31,7 @@
#include <GEOMImpl_ShapeDriver.hxx> #include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMUtils.hxx> #include <GEOMUtils.hxx>
//#include <GEOMAlgo_RemoverWebs.hxx> #include <GEOMAlgo_RemoverWebs.hxx>
#include <ShHealOper_ShapeProcess.hxx> #include <ShHealOper_ShapeProcess.hxx>
#include <ShHealOper_RemoveFace.hxx> #include <ShHealOper_RemoveFace.hxx>
@ -454,7 +454,7 @@ Standard_Boolean GEOMImpl_HealingDriver::Sew (GEOMImpl_IHealing* theHI,
Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape, Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape& theOriginalShape,
TopoDS_Shape& theOutShape) const TopoDS_Shape& theOutShape) const
{ {
/* GEOMAlgo_RemoverWebs aTool; GEOMAlgo_RemoverWebs aTool;
aTool.SetShape(theOriginalShape); aTool.SetShape(theOriginalShape);
aTool.Perform(); aTool.Perform();
@ -472,8 +472,6 @@ Standard_Boolean GEOMImpl_HealingDriver::RemoveInternalFaces (const TopoDS_Shape
} }
return Standard_True; return Standard_True;
*/
return Standard_False;
} }
//======================================================================= //=======================================================================

View File

@ -397,4 +397,4 @@ def TestHealingOperations (geompy, math):
TestSuppressFaces(geompy) TestSuppressFaces(geompy)
TestProcessShape(geompy) TestProcessShape(geompy)
TestFuseEdges(geompy) TestFuseEdges(geompy)
#TestRemoveWebs(geompy) TestRemoveWebs(geompy)