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,
// 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
// <pkv@irinox>
//
#include <GEOMAlgo_RemoverWebs.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.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 <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx>
#include <BOPInt_Context.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <GEOMAlgo_BuilderSolid.hxx>
#include <GEOMAlgo_Tools3D.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
//=======================================================================
//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);
}
}
}

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,
// 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
// <pkv@petrex>
//
// The algorithm is intended to build result [solid(s)]
// from given set of solids [argument].
// The result cosists of:
@ -39,8 +38,8 @@
#include <Standard_Macro.hxx>
//
#include <GEOMAlgo_ShapeAlgo.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
//=======================================================================
//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& );
//
};

View File

@ -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 \

View File

@ -31,7 +31,7 @@
#include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMUtils.hxx>
//#include <GEOMAlgo_RemoverWebs.hxx>
#include <GEOMAlgo_RemoverWebs.hxx>
#include <ShHealOper_ShapeProcess.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,
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;
}
//=======================================================================

View File

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