GEOMAlgo_HAlgo.hxx
GEOMAlgo_HAlgo.cxx
+GEOMAlgo_RemoverWebs.hxx
+GEOMAlgo_RemoverWebs.cxx
+
GEOMAlgo_ListOfCoupleOfShapes.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
GEOMAlgo_ListOfPnt.hxx
imported GluerAlgo from GEOMAlgo;
imported GetInPlace from GEOMAlgo;
-- Algos
+ imported RemoverWebs from GEOMAlgo;
imported WireSplitter from GEOMAlgo;
imported WESScaler from GEOMAlgo;
imported WESCorrector from GEOMAlgo;
imported IndexedDataMapOfShapeState from GEOMAlgo;
imported IndexedDataMapOfIntegerShape from GEOMAlgo;
imported IndexedDataMapOfPassKeyShapeListOfShape from GEOMAlgo;
-
-
- -- Instantiations
-
- --class ListOfCoupleOfShapes
- -- instantiates List from TCollection (CoupleOfShapes from GEOMAlgo);
-
- --class ListOfPnt
- -- instantiates List from TCollection (Pnt from gp);
- --
-
- --class DataMapOfShapeShapeSet instantiates
- -- DataMap from TCollection(Shape from TopoDS,
- -- ShapeSet from GEOMAlgo,
- -- ShapeMapHasher from TopTools);
-
- --class DataMapOfShapeReal instantiates
- -- DataMap from TCollection(Shape from TopoDS,
- -- Real from Standard,
- -- ShapeMapHasher from TopTools);
-
-
- --class DataMapOfRealListOfShape instantiates
- -- DataMap from TCollection(Real from Standard,
- -- ListOfShape from TopTools,
- -- MapRealHasher from TColStd);
-
-
- --class DataMapOfPassKeyInteger
- -- instantiates DataMap from TCollection (PassKey from GEOMAlgo,
- -- Integer from Standard,
- -- PassKeyMapHasher from GEOMAlgo);
-
- --class DataMapOfPassKeyShapeShape
- -- instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo,
- -- Shape from TopoDS,
- -- PassKeyShapeMapHasher from GEOMAlgo);
-
- --class DataMapOfOrientedShapeShape instantiates
- -- DataMap from TCollection (Shape from TopoDS,
- -- Shape from TopoDS,
- -- OrientedShapeMapHasher from TopTools);
-
-
- --class DataMapOfShapeMapOfShape instantiates
- -- DataMap from TCollection (Shape from TopoDS,
- -- MapOfShape from TopTools,
- -- ShapeMapHasher from TopTools);
-
- --class DataMapOfShapePnt instantiates
- -- DataMap from TCollection (Shape from TopoDS,
- -- Pnt from gp,
- -- ShapeMapHasher from TopTools);
-
- --
- --class IndexedDataMapOfShapeBox
- -- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
--- Box from Bnd,
--- ShapeMapHasher from TopTools);
-
--- class IndexedDataMapOfShapeShapeInfo
--- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
--- ShapeInfo from GEOMAlgo,
--- ShapeMapHasher from TopTools);
--- class IndexedDataMapOfShapeState
--- instantiates IndexedDataMap from TCollection (Shape from TopoDS,
--- State from TopAbs,
--- ShapeMapHasher from TopTools);
-
-
---
--- class IndexedDataMapOfIntegerShape
--- instantiates IndexedDataMap from TCollection (Integer from Standard,
--- Shape from TopoDS,
--- MapIntegerHasher from TColStd);
-
-
--- class IndexedDataMapOfPassKeyShapeListOfShape
--- instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo,
--- ListOfShape from TopTools,
--- PassKeyShapeMapHasher from GEOMAlgo);
-
-
-
-
-
-
+
end GEOMAlgo;
- --
- -- enumerations
- --
- --enumeration State is
- -- ST_UNKNOWN,
--- ST_IN,
--- ST_OUT,
--- ST_ON,
--- ST_ONIN,
--- ST_ONOUT,
--- ST_INOUT
--- end State;
- --
--- enumeration KindOfShape is
--- KS_UNKNOWN,
--- KS_SPHERE,
--- KS_CYLINDER,
--- KS_BOX,
--- KS_TORUS,
--- KS_CONE,
--- KS_ELLIPSE,
--- KS_PLANE,
--- KS_CIRCLE,
--- KS_LINE,
--- KS_DEGENERATED
--- end KindOfShape;
- --
--- enumeration KindOfName is
--- KN_UNKNOWN,
--- KN_SPHERE,
--- KN_CYLINDER,
--- KN_TORUS,
--- KN_CONE,
--- KN_ELLIPSE,
--- KN_CIRCLE,
--- KN_PLANE,
--- KN_LINE,
--- KN_BOX,
--- KN_SEGMENT,
--- KN_ARCCIRCLE,
--- KN_POLYGON,
--- KN_POLYHEDRON,
--- KN_DISKCIRCLE,
--- KN_DISKELLIPSE,
--- KN_RECTANGLE,
--- KN_TRIANGLE,
--- KN_QUADRANGLE,
--- KN_ARCELLIPSE
--- end KindOfName;
- --
- -- enumeration KindOfBounds is
- -- KB_UNKNOWN,
--- KB_TRIMMED,
- -- KB_INFINITE
--- end KindOfBounds;
- --
--- enumeration KindOfClosed is
--- KC_UNKNOWN,
--- KC_CLOSED,
--- KC_NOTCLOSED
--- end KindOfClosed;
- --
-
- --deferred class HAlgo;
- --deferred class Clsf;
- --class ClsfSurf;
- --class ClsfBox;
- --class ClsfSolid;
-
- --
- -- classes
- --
- --deferred class Algo;
- --deferred class ShapeAlgo;
- --
- --class ShapeInfo;
- --class ShapeInfoFiller;
- --class CoupleOfShapes;
- --class SurfaceTools;
- --class Tools;
- --class PassKey;
- --class PassKeyMapHasher;
- --class PassKeyShape;
- --class PassKeyShapeMapHasher;
- --
- -- finder on
- --deferred class ShapeSolid;
- --class WireSolid;
- --class ShellSolid;
- --class VertexSolid;
- --class SolidSolid;
- --class StateCollector;
-
- --
- --class Gluer;
- --class GlueAnalyser;
- --class FinderShapeOn;
- --class FinderShapeOn1;
- --class FinderShapeOn2;
- --
- -- Builder/Splitter
- --deferred class BuilderShape;
- --class Builder;
- --class Splitter;
- --class Tools3D;
- --class BuilderTools;
- --class ShapeSet;
-
- --deferred class BuilderArea;
- --class BuilderFace;
- --class BuilderSolid;
-
- --class WireSplitter;
- --class WireEdgeSet;
- --class WESCorrector;
- --class WESScaler;
- --
- -- Pointers
- --
- --pointer PWireEdgeSet to WireEdgeSet from GEOMAlgo;
- --
- --
--- /dev/null
+// Copyright (C) 2007-2012 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
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_RemoverWebs.cxx
+// Created: Thu Mar 28 07:40:32 2013
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_RemoverWebs.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 <GEOMAlgo_ShapeAlgo.hxx>
+#include <GEOMAlgo_BuilderSolid.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
+
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+GEOMAlgo_RemoverWebs::GEOMAlgo_RemoverWebs()
+:
+ GEOMAlgo_ShapeAlgo()
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+GEOMAlgo_RemoverWebs::~GEOMAlgo_RemoverWebs()
+{
+}
+//=======================================================================
+//function : CheckData
+//purpose :
+//=======================================================================
+void GEOMAlgo_RemoverWebs::CheckData()
+{
+ TopoDS_Iterator aIt;
+ //
+ myErrorStatus=0;
+ //
+ if (myShape.IsNull()) {
+ myErrorStatus=10;
+ return;
+ }
+ //
+ aIt.Initialize(myShape);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS=aIt.Value();
+ if (aS.ShapeType()!=TopAbs_SOLID) {
+ myErrorStatus=11;
+ return;
+ }
+ }
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GEOMAlgo_RemoverWebs::Perform()
+{
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ // 1.
+ CheckData();
+ if(myErrorStatus) {
+ return;
+ }
+ //
+ // 2. Init myContext
+ if (!myContext.IsNull()) {
+ myContext.Nullify();
+ }
+ myContext=new IntTools_Context;
+ //
+ BuildSolid();
+ //
+}
+
+//=======================================================================
+//function : BuildSolid
+//purpose :
+//=======================================================================
+void GEOMAlgo_RemoverWebs::BuildSolid()
+{
+ Standard_Integer i, aNbF, aNbSx, iErr, aNbSI, aNbF2;
+ 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;
+ //
+ aNbF2=0;
+ //
+ // 1. aSFS: Faces
+ TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
+ //
+ aNbF=aMFS.Extent();
+ for (i=1; i<=aNbF; ++i) {
+ const TopoDS_Shape& aFx=aMFS.FindKey(i);
+ aOr=aFx.Orientation();
+ if (aOr==TopAbs_INTERNAL) {
+ TopoDS_Shape aFi;
+ //
+ aFi=aFx;
+ aFi.Orientation(TopAbs_FORWARD);
+ aSFS.Append(aFi);
+ aFi.Orientation(TopAbs_REVERSED);
+ aSFS.Append(aFi);
+ }
+ else {
+ const TopTools_ListOfShape& aLSx=aMFS(i);
+ aNbSx=aLSx.Extent();
+ if (aNbSx==1) {
+ aSFS.Append(aFx);
+ }
+ else if (aNbSx==2) {
+ ++aNbF2;
+ }
+ }
+ }
+ //
+ if (!aNbF2) { // nothing to do here
+ myResult=myShape;
+ return;
+ }
+ //
+ // 2 Internal shapes: edges, vertices
+ aIt1.Initialize(myShape);
+ for (; aIt1.More(); aIt1.Next()) {
+ const TopoDS_Shape& aSD=aIt1.Value();
+ //
+ aIt2.Initialize(aSD);
+ 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);
+ }
+ }
+ }
+ }
+ aNbSI=aMSI.Extent();
+ //
+ // 3 Solids without internals
+ GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, myResult);
+ //
+ aSB.SetContext(myContext);
+ aSB.SetShapes(aSFS);
+ aSB.Perform();
+ iErr=aSB.ErrorStatus();
+ if (iErr) {
+ myErrorStatus=20; // SolidBuilder failed
+ return;
+ }
+ //
+ const TopTools_ListOfShape& aLSR=aSB.Areas();
+ //
+ // 4 Add the internals
+ if (aNbSI) {
+ AddInternalShapes(aLSR, aMSI);
+ }
+ //
+ aItLS.Initialize(aLSR);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSR=aItLS.Value();
+ aBB.Add(myResult, aSR);
+ }
+}
+
+//=======================================================================
+//function : AddInternalShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_RemoverWebs::AddInternalShapes(const TopTools_ListOfShape& aLSR,
+ const TopTools_IndexedMapOfShape& aMSI)
+{
+ Standard_Integer i, aNbSI;
+ TopAbs_State aState;
+ TopoDS_Solid aSd;
+ BRep_Builder aBB;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ Handle(IntTools_Context) aCtx;
+ //
+ aCtx=new IntTools_Context;
+ //
+ aNbSI=aMSI.Extent();
+ for (i=1; i<=aNbSI; ++i) {
+ const TopoDS_Shape& aSI=aMSI(i);
+ //
+ aItLS.Initialize(aLSR);
+ for (; aItLS.More(); aItLS.Next()) {
+ aSd=*((TopoDS_Solid*)&aItLS.Value());
+ //
+ aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);
+ if (aState==TopAbs_IN) {
+ aBB.Add(aSd, aSI);
+ //
+ BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSd);
+ aSC.Load(aSd);
+ }
+ }
+ }
+}
+//
+// myErrorStatus
+// 0 - OK
+// 10 - myShape is Null
+// 11 - myShape contains non-solids
+// 20 - BuilderSolid failed
--- /dev/null
+// Copyright (C) 2007-2012 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
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// 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:
+// - outer faces from the argument;
+// - other internal parts of the argument;
+// The result does not contain the faces of the argument
+// that becomes inner faces (webs) for the result.
+
+#ifndef _GEOMAlgo_RemoverWebs_HeaderFile
+#define _GEOMAlgo_RemoverWebs_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+//
+#include <GEOMAlgo_ShapeAlgo.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+//=======================================================================
+//function : GEOMAlgo_RemoverWebs
+//purpose :
+//=======================================================================
+class GEOMAlgo_RemoverWebs : public GEOMAlgo_ShapeAlgo
+{
+ public:
+ Standard_EXPORT
+ GEOMAlgo_RemoverWebs();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_RemoverWebs();
+
+ Standard_EXPORT
+ virtual void Perform() ;
+
+protected:
+ Standard_EXPORT
+ virtual void CheckData() ;
+
+
+ Standard_EXPORT
+ void BuildSolid() ;
+
+ Standard_EXPORT
+ static void AddInternalShapes(const TopTools_ListOfShape& ,
+ const TopTools_IndexedMapOfShape& );
+ //
+};
+
+#endif
GEOMAlgo_PassKeyMapHasher.cxx \
GEOMAlgo_PassKeyShape.cxx \
GEOMAlgo_PassKeyShapeMapHasher.cxx \
+ GEOMAlgo_RemoverWebs.cxx \
GEOMAlgo_ShapeAlgo.cxx \
GEOMAlgo_ShapeInfo.cxx \
GEOMAlgo_ShapeInfoFiller_1.cxx \
GEOMAlgo_PassKeyShape.hxx \
GEOMAlgo_PassKeyShapeMapHasher.hxx \
GEOMAlgo_PWireEdgeSet.hxx \
+ GEOMAlgo_RemoverWebs.hxx \
GEOMAlgo_ShapeAlgo.hxx \
GEOMAlgo_ShapeInfo.hxx \
GEOMAlgo_ShapeInfoFiller.hxx \