]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IMPs 19766 (Wire from unconnected edges) and 20004 (NumberOfSolids)
authorjfa <jfa@opencascade.com>
Wed, 27 May 2009 11:46:05 +0000 (11:46 +0000)
committerjfa <jfa@opencascade.com>
Wed, 27 May 2009 11:46:05 +0000 (11:46 +0000)
21 files changed:
doc/salome/gui/GEOM/images/neo-obj3.png
doc/salome/gui/GEOM/input/creating_wire.doc
doc/salome/gui/GEOM/input/tui_test_others.doc
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/BuildGUI/BuildGUI_WireDlg.cxx
src/BuildGUI/BuildGUI_WireDlg.h
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_IShapes.hxx
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.hh
src/GEOM_I/GEOM_Object_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/geompyDC.py

index 65464a70cd4fda36a51ba4ad7f4cf987c62fe1b0..cb9bd40b18114f8b3ecc5b25bf0fe90d8c61e372 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/neo-obj3.png and b/doc/salome/gui/GEOM/images/neo-obj3.png differ
index 54cf6c79a7b894322a2a2f54d9c761995cc28a3d..1443599cda7617b4fde98dd3d4992e7eb6f2972a 100644 (file)
@@ -6,12 +6,15 @@
 
 \n You can create a \b Wire from several connected edges and wires by
 selecting them in the object browser or in the viewer holding Shift
-button.
-\n The \b Result  will be a \b GEOM_Object (WIRE).
+button. Select \b Tolerance which will be used to check
+connections. If you use \b Tolerance more than 1e-07, and gap,
+covered by this tolerance, is detected, edges will be modified to
+connect in the middle of the gap.
+\n The \b Result will be a \b GEOM_Object (WIRE).
 
-\n <b>TUI Command:</b> <em>geompy.MakeWire(ListOfShape)</em>
+\n <b>TUI Command:</b> <em>geompy.MakeWire(ListOfShape, Tolerance)</em>
 
-<b>Arguments:</b> Name + List of connected wires or edges.
+<b>Arguments:</b> Name + List of connected wires or edges + Tolerance.
 
 \n <b>Dialog Box:</b>
 
@@ -24,4 +27,4 @@ button.
 Our <b>TUI Scripts</b> provide you with useful examples of creation of 
 \ref tui_creation_wire "Advanced Geometric Objects".
 
-*/
\ No newline at end of file
+*/
index 32d3c8b21c0b10f26a7cd6d70bf1b1fd589166b1..332f3d58db1d28d3e238f79d08ed06688844138f 100644 (file)
 \anchor swig_MakeChamfer
 \until id_MakeChamfer
 
-\anchor swig_NumberOfFaces
-\until Bad number of faces
-
-\anchor swig_NumberOfEdges
-\until Bad number of edges
+\anchor swig_NumberOf
+\until Bad number of shapes
 
 \anchor swig_MakeBlockExplode
 \until id_MakeBlockExplode
index 04aa32a406acfb94e30afbf2a7149bfd965b3f53..1109bde2c156f264283cc599fda7ade7eb33f705 100644 (file)
@@ -1202,9 +1202,12 @@ module GEOM
     /*!
      *  Create a wire from the set of edges and wires.
      *  \param theEdgesAndWires List of edge and/or wires.
+     *  \param theTolerance Maximum distance between vertices, that will be merged.
+     *                      Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
      *  \return New GEOM_Object, containing the created wire.
      */
-    GEOM_Object MakeWire (in ListOfGO theEdgesAndWires);
+    GEOM_Object MakeWire (in ListOfGO theEdgesAndWires,
+                          in double   theTolerance);
 
     /*!
      *  Create a face on the given wire.
@@ -1358,6 +1361,15 @@ module GEOM
      */
     long NumberOfEdges (in GEOM_Object theShape);
 
+    /*!
+     *  Count number of subshapes of type \a theShapeType in the given shape.
+     *  \param theShape Shape to count subshapes in.
+     *  \param theShapeType The type of subshapes to count.
+     *  \return Number of subshapes of type \a theShapeType in \a theShape.
+     */
+    long NumberOfSubShapes (in GEOM_Object theShape,
+                            in long        theShapeType);
+
     /*!
      *  Reverses an orientation the given shape.
      *  \param theShape Shape to be reversed.
index ed433499404251d680405b16b003b5631d70873d..1f6d2f769d73daf23f188c25a6d6dcd77dd98237 100644 (file)
@@ -360,7 +360,8 @@ module GEOM
     //-----------------------------------------------------------//
     GEOM_Object MakeEdge (in GEOM_Object thePnt1, 
                          in GEOM_Object thePnt2) ;
-    GEOM_Object MakeWire (in GEOM_List theEdgesAndWires) ;
+    GEOM_Object MakeWire (in GEOM_List theEdgesAndWires,
+                          in double    theTolerance) ;
     GEOM_Object MakeFace (in GEOM_Object theWire, 
                          in boolean     isPlanarWanted) ;
     GEOM_Object MakeFaceWires (in GEOM_List theWires, 
index 05326e4570afe7636deac44857b85612b2399508..5acb5845ecfc2fd47009f1f769d38636c1db6fd7 100644 (file)
@@ -22,7 +22,7 @@
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : BuildGUI_WireDlg.cxx
 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
 #include "BuildGUI_WireDlg.h"
 
 #include <GEOMImpl_Types.hxx>
@@ -37,6 +37,7 @@
 #include <LightApp_SelectionMgr.h>
 
 #include <TColStd_MapOfInteger.hxx>
+#include <Precision.hxx>
 
 //=================================================================================
 // class    : BuildGUI_WireDlg()
@@ -61,16 +62,22 @@ BuildGUI_WireDlg::BuildGUI_WireDlg( GeometryGUI* theGeometryGUI, QWidget* parent
   mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
   mainFrame()->RadioButton3->close();
 
-  GroupPoints = new DlgRef_1Sel( centralWidget() );
+  GroupArgs = new DlgRef_1Sel1Spin( centralWidget() );
 
-  GroupPoints->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) );
-  GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
-  GroupPoints->PushButton1->setIcon( image1 );
-  GroupPoints->LineEdit1->setReadOnly( true );
+  GroupArgs->GroupBox1->setTitle( tr( "GEOM_WIRE_CONNECT" ) );
+  GroupArgs->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
+  GroupArgs->PushButton1->setIcon( image1 );
+  GroupArgs->LineEdit1->setReadOnly( true );
+
+  GroupArgs->TextLabel2->setText( tr( "GEOM_TOLERANCE" ) );
+  double SpecificStep = 0.0001;
+  double prec = Precision::Confusion();
+  initSpinBox(GroupArgs->SpinBox_DX, prec, MAX_NUMBER, SpecificStep, 9);
+  GroupArgs->SpinBox_DX->setValue(prec);
 
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
-  layout->addWidget( GroupPoints );
+  layout->addWidget( GroupArgs );
   /***************************************************************/
 
   setHelpFileName( "create_wire_page.html" );
@@ -97,8 +104,8 @@ BuildGUI_WireDlg::~BuildGUI_WireDlg()
 void BuildGUI_WireDlg::Init()
 {
   /* init variables */
-  myEditCurrentArgument = GroupPoints->LineEdit1;
-  GroupPoints->LineEdit1->setReadOnly( true );
+  myEditCurrentArgument = GroupArgs->LineEdit1;
+  GroupArgs->LineEdit1->setReadOnly( true );
   
   myOkEdgesAndWires = false;
   
@@ -110,7 +117,7 @@ void BuildGUI_WireDlg::Init()
   /* signals and slots connections */
   connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-  connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupArgs->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
   
@@ -180,14 +187,14 @@ void BuildGUI_WireDlg::SelectionIntoArgument()
 void BuildGUI_WireDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  if ( send != GroupPoints->PushButton1 )
+  if ( send != GroupArgs->PushButton1 )
     return;
 
   TColStd_MapOfInteger aMap;
   aMap.Add( GEOM_WIRE );
   aMap.Add( GEOM_EDGE );
   globalSelection( aMap );
-  myEditCurrentArgument = GroupPoints->LineEdit1;
+  myEditCurrentArgument = GroupArgs->LineEdit1;
 
   myEditCurrentArgument->setFocus();
   SelectionIntoArgument();
@@ -233,25 +240,25 @@ GEOM::GEOM_IOperations_ptr BuildGUI_WireDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool BuildGUI_WireDlg::isValid( QString& )
+bool BuildGUI_WireDlg::isValid (QString& msg)
 {
-  return myOkEdgesAndWires;
+  bool ok = GroupArgs->SpinBox_DX->isValid(msg, !IsPreview());
+  return myOkEdgesAndWires && ok;
 }
 
 //=================================================================================
 // function : execute
 // purpose  :
 //=================================================================================
-bool BuildGUI_WireDlg::execute( ObjectList& objects )
+bool BuildGUI_WireDlg::execute (ObjectList& objects)
 {
   GEOM::GEOM_Object_var anObj;
 
-  anObj = GEOM::GEOM_IShapesOperations::_narrow(
-    getOperation() )->MakeWire( myEdgesAndWires );
+  anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())->
+    MakeWire(myEdgesAndWires, GroupArgs->SpinBox_DX->value());
 
-  if ( !anObj->_is_nil() )
-    objects.push_back( anObj._retn() );
+  if (!anObj->_is_nil())
+    objects.push_back(anObj._retn());
 
   return true;
 }
-
index 616df02464d5c0049f7a0ed635df5698b1b2ca8c..6b500ee30709104b33e961d382abd35d6cdb1498 100644 (file)
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : BuildGUI_WireDlg.h
 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
 #ifndef BUILDGUI_WIREDLG_H
 #define BUILDGUI_WIREDLG_H
 
 #include <GEOMBase_Skeleton.h>
 
-class DlgRef_1Sel;
+class DlgRef_1Sel1Spin;
 
 //=================================================================================
 // class    : BuildGUI_WireDlg
@@ -56,7 +56,7 @@ private:
   GEOM::ListOfGO                     myEdgesAndWires;
   bool                               myOkEdgesAndWires;   /* to check when arguments is defined */
   
-  DlgRef_1Sel*                       GroupPoints;
+  DlgRef_1Sel1Spin*                  GroupArgs;
 
 private slots:
   void                               ClickOnOk();
index ffa7b4d3fd3297e2af21c36b6ffd0914403ae957..8b68577976c3875db93f26ad209fd92547a6e034 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #include <Standard_Stream.hxx>
 
 #include <GEOMImpl_I3DPrimOperations.hxx>
@@ -61,7 +61,6 @@
 #include <GEOMImpl_IPrism.hxx>
 #include <GEOMImpl_IPipe.hxx>
 #include <GEOMImpl_IRevolution.hxx>
-#include <GEOMImpl_IShapes.hxx>
 #include <GEOMImpl_IFilling.hxx>
 #include <GEOMImpl_IThruSections.hxx>
 #include <GEOMImpl_IPipeDiffSect.hxx>
@@ -1447,59 +1446,6 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
   return aRevolution;
 }
 
-//=============================================================================
-/*!
- *  MakeSolidShell
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Object) theShell)
-{
-  SetErrorCode(KO);
-
-  if (theShell.IsNull()) return NULL;
-
-  //Add a new Solid object
-  Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
-
-  //Add a new Solid function for creation a solid from a shell
-  Handle(GEOM_Function) aFunction =
-    aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_SHELL);
-  if (aFunction.IsNull()) return NULL;
-
-  //Check if the function is set correctly
-  if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
-
-  GEOMImpl_IShapes aCI (aFunction);
-
-  Handle(GEOM_Function) aRefShell = theShell->GetLastFunction();
-
-  if (aRefShell.IsNull()) return NULL;
-
-  aCI.SetBase(aRefShell);
-
-  //Compute the Solid value
-  try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
-    OCC_CATCH_SIGNALS;
-#endif
-    if (!GetSolver()->ComputeFunction(aFunction)) {
-      SetErrorCode("Solid driver failed");
-      return NULL;
-    }
-  }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
-    return NULL;
-  }
-
-  //Make a Python command
-  GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")";
-
-  SetErrorCode(OK);
-  return aSolid;
-}
-
 //=============================================================================
 /*!
  *  MakeFilling
index 6f1295b41919829845a2256019ad856069f2b5fd..151ea1218c46716c9e93925c3477d95c36b5a821 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #ifndef _GEOMImpl_I3DPrimOperations_HXX_
 #define _GEOMImpl_I3DPrimOperations_HXX_
 
@@ -97,14 +97,16 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
                                                                    Handle(GEOM_Object) theAxis,
                                                                    double theAngle);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
-
-  Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter, bool isApprox);
+  Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape,
+                                                   int theMinDeg, int theMaxDeg,
+                                                   double theTol2D, double theTol3D,
+                                                   int theNbIter, bool isApprox);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeThruSections(const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
-                                                      bool theModeSolid,
-                                                      double thePreci,
-                                                       bool theRuled);
+  Standard_EXPORT Handle(GEOM_Object) MakeThruSections
+                                      (const Handle(TColStd_HSequenceOfTransient)& theSeqSections,
+                                       bool theModeSolid,
+                                       double thePreci,
+                                       bool theRuled);
 
   Standard_EXPORT Handle(GEOM_Object) MakePipeWithDifferentSections(
                const Handle(TColStd_HSequenceOfTransient)& theBases,
index a4efd51612e83568343fa2e7f431cd3ec61d2352..e0827f4ea89a20c4642079fd27719e290bd8f48a 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// NOTE: This is an intreface to a function for the Shapes
-// (Wire, Face, Shell, Solid and Compound) creation.
-//
+//  NOTE: This is an intreface to a function for the Shapes
+//  (Wire, Face, Shell, Solid and Compound) creation.
+
 #include "GEOM_Function.hxx"
 
 #include "TColStd_HSequenceOfTransient.hxx"
 #include "TColStd_HArray1OfInteger.hxx"
 
-#define SHAPE_ARG_SHAPES  1 // for Wire, Shell, Solid and Compound
-
-#define SHAPE_ARG_BASE    2 // for Face, Solid and Sub-shape
-
-#define SHAPE_ARG_PLANAR  3 // for Face
-
-#define SHAPE_ARG_SUBTYPE 4 // for Sub-shape
-#define SHAPE_ARG_INDICES 5 // for Sub-shape
-
 class GEOMImpl_IShapes
 {
  public:
 
+  enum {
+    SHAPE_ARG_SHAPES    = 1, // for Wire, Shell, Solid and Compound
+    SHAPE_ARG_BASE      = 2, // for Face, Solid and Sub-shape
+    SHAPE_ARG_PLANAR    = 3, // for Face
+    SHAPE_ARG_SUBTYPE   = 4, // for Sub-shape
+    SHAPE_ARG_INDICES   = 5, // for Sub-shape
+    SHAPE_ARG_TOLERANCE = 6  // for Wire
+  };
+
   GEOMImpl_IShapes(Handle(GEOM_Function) theFunction): _func(theFunction) {}
 
   void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
@@ -69,6 +69,11 @@ class GEOMImpl_IShapes
   Handle(TColStd_HArray1OfInteger) GetIndices()
   { return _func->GetIntegerArray(SHAPE_ARG_INDICES); }
 
+  void SetTolerance(const Standard_Real theValue)
+  { _func->SetReal(SHAPE_ARG_TOLERANCE, theValue); }
+
+  Standard_Integer GetTolerance() { return _func->GetReal(SHAPE_ARG_TOLERANCE); }
+
  private:
 
   Handle(GEOM_Function) _func;
index 1abf840245b06ba5d779f54baa8fa57d9a3ad1a5..519f6c82ba1fa8f4770a7be743b9d59859bababc 100644 (file)
@@ -214,9 +214,71 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeWire
-                             (std::list<Handle(GEOM_Object)> theShapes)
+                             (std::list<Handle(GEOM_Object)> theShapes,
+                              const Standard_Real            theTolerance)
 {
-  return MakeShape(theShapes, GEOM_WIRE, WIRE_EDGES, "MakeWire");
+  SetErrorCode(KO);
+
+  //Add a new object
+  Handle(GEOM_Object) aWire = GetEngine()->AddObject(GetDocID(), GEOM_WIRE);
+
+  //Add a new function
+  Handle(GEOM_Function) aFunction =
+    aWire->AddFunction(GEOMImpl_ShapeDriver::GetID(), WIRE_EDGES);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
+
+  GEOMImpl_IShapes aCI (aFunction);
+  aCI.SetTolerance(theTolerance);
+
+  Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
+
+  // Shapes
+  std::list<Handle(GEOM_Object)>::iterator it = theShapes.begin();
+  for (; it != theShapes.end(); it++) {
+    Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
+    if (aRefSh.IsNull()) {
+      SetErrorCode("NULL argument shape for the shape construction");
+      return NULL;
+    }
+    aShapesSeq->Append(aRefSh);
+  }
+  aCI.SetShapes(aShapesSeq);
+
+  //Compute the shape
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Shape driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump pd (aFunction);
+  pd << aWire << " = geompy.MakeWire([";
+
+  // Shapes
+  it = theShapes.begin();
+  if (it != theShapes.end()) {
+    pd << (*it++);
+    while (it != theShapes.end()) {
+      pd << ", " << (*it++);
+    }
+  }
+  pd << "])";
+
+  SetErrorCode(OK);
+  return aWire;
 }
 
 //=============================================================================
@@ -442,7 +504,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeCompound
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
-                             (std::list<Handle(GEOM_Object)>      theShapes,
+                             (std::list<Handle(GEOM_Object)> theShapes,
                               const Standard_Integer         theObjectType,
                               const Standard_Integer         theFunctionType,
                               const TCollection_AsciiString& theMethodName)
@@ -1103,54 +1165,83 @@ TCollection_AsciiString GEOMImpl_IShapesOperations::GetShapeTypeString (Handle(G
 
 //=============================================================================
 /*!
- *  NumberOfFaces
+ *  NumberOfSubShapes
  */
 //=============================================================================
-Standard_Integer GEOMImpl_IShapesOperations::NumberOfFaces (Handle(GEOM_Object) theShape)
+Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes
+                                          (Handle(GEOM_Object)    theShape,
+                                           const Standard_Integer theShapeType)
 {
   SetErrorCode(KO);
-
-  Standard_Integer nb = 0;
+  Standard_Integer nbShapes = 0;
 
   if (theShape.IsNull()) return -1;
   TopoDS_Shape aShape = theShape->GetValue();
   if (aShape.IsNull()) return -1;
 
+  /*
   TopTools_MapOfShape mapShape;
 
-  TopExp_Explorer exp (aShape, TopAbs_FACE);
-  for (; exp.More(); exp.Next())
-    if (mapShape.Add(exp.Current()))
-      nb++;
-
-  SetErrorCode(OK);
-  return nb;
-}
-
-//=============================================================================
-/*!
- *  NumberOfEdges
- */
-//=============================================================================
-Standard_Integer GEOMImpl_IShapesOperations::NumberOfEdges (Handle(GEOM_Object) theShape)
-{
-  SetErrorCode(KO);
-
-  Standard_Integer nb = 0;
-
-  if (theShape.IsNull()) return -1;
-  TopoDS_Shape aShape = theShape->GetValue();
-  if (aShape.IsNull()) return -1;
+  if (aShape.ShapeType() == TopAbs_COMPOUND &&
+      (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
+       TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPSOLID ||
+       TopAbs_ShapeEnum(theShapeType) == TopAbs_COMPOUND)) {
+    TopoDS_Iterator It (aShape, Standard_True, Standard_True);
+    for (; It.More(); It.Next()) {
+      if (mapShape.Add(It.Value())) {
+        if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE ||
+            TopAbs_ShapeEnum(theShapeType) == It.Value().ShapeType()) {
+          nbShapes++;
+        }
+      }
+    }
+  } else {
+    TopExp_Explorer exp (aShape, TopAbs_ShapeEnum(theShapeType));
+    for (; exp.More(); exp.Next())
+      if (mapShape.Add(exp.Current()))
+       nbShapes++;
+  }
+  */
 
-  TopTools_MapOfShape mapShape;
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    int iType, nbTypes [TopAbs_SHAPE];
+    for (iType = 0; iType < TopAbs_SHAPE; ++iType)
+      nbTypes[iType] = 0;
+    nbTypes[aShape.ShapeType()]++;
+
+    TopTools_MapOfShape aMapOfShape;
+    aMapOfShape.Add(aShape);
+    TopTools_ListOfShape aListOfShape;
+    aListOfShape.Append(aShape);
+
+    TopTools_ListIteratorOfListOfShape itL (aListOfShape);
+    for (; itL.More(); itL.Next()) {
+      TopoDS_Iterator it (itL.Value());
+      for (; it.More(); it.Next()) {
+        TopoDS_Shape s = it.Value();
+        if (aMapOfShape.Add(s)) {
+          aListOfShape.Append(s);
+          nbTypes[s.ShapeType()]++;
+        }
+      }
+    }
 
-  TopExp_Explorer exp (aShape, TopAbs_EDGE);
-  for (; exp.More(); exp.Next())
-    if (mapShape.Add(exp.Current()))
-      nb++;
+    if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE)
+      nbShapes = aMapOfShape.Extent();
+    else
+      nbShapes = nbTypes[theShapeType];
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return -1;
+  }
 
   SetErrorCode(OK);
-  return nb;
+  return nbShapes;
 }
 
 //=============================================================================
index 3deb09d0abdd2e9712d944b729d5fb8356fa3124..373e1a82a5b373f1f3c7a7c1cf00f6c8fafb25bc 100644 (file)
@@ -26,7 +26,7 @@
 // Project   : SALOME
 // $Header$
 //=============================================================================
-//
+
 #ifndef _GEOMImpl_IShapesOperations_HXX_
 #define _GEOMImpl_IShapesOperations_HXX_
 
@@ -56,7 +56,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
   Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
                                 Handle(GEOM_Object) thePoint2);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires);
+  Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires,
+                                                const Standard_Real            theTolerance);
 
   Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
 
@@ -102,8 +103,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
 
   Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
 
-  Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
-  Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
+  Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object)    theShape,
+                                                      const Standard_Integer theShapeType);
 
   Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
 
index 43af2ed5cc6cde367c3441321ddbf31788695119..1165007ea9f0bab0746bb005447220d30d6f6688 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #include <GEOMImpl_ShapeDriver.hxx>
 
 #include <GEOMImpl_IShapes.hxx>
@@ -29,6 +29,7 @@
 
 // OCCT Includes
 #include <ShapeFix_Wire.hxx>
+#include <ShapeFix_Edge.hxx>
 
 #include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
@@ -152,17 +153,37 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
         Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
       } else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
         Standard_ConstructionError::Raise("Wire construction failed");
-      } else if (aFW->StatusReorder(ShapeExtend_DONE2)) {
-        Standard_ConstructionError::Raise("Wire construction failed: some gaps detected");
+      //} else if (aFW->StatusReorder(ShapeExtend_DONE2)) {
+      //  Standard_ConstructionError::Raise("Wire construction failed: some gaps detected");
       } else {
       }
 
+      // IMP 0019766: Building a Wire from unconnected edges by introducing a tolerance
+      Standard_Real aTolerance = aCI.GetTolerance();
+      if (aTolerance < Precision::Confusion())
+        aTolerance = Precision::Confusion();
+
       aFW->ClosedWireMode() = Standard_False;
-      aFW->FixConnected();
+      aFW->FixConnected(aTolerance);
       if (aFW->StatusConnected(ShapeExtend_FAIL)) {
         Standard_ConstructionError::Raise("Wire construction failed: cannot build connected wire");
       }
 
+      // IMP 0019766
+      aFW->FixGapsByRangesMode() = Standard_True;
+      if (aFW->FixGaps3d()) {
+        Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
+        Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
+        for (Standard_Integer iedge = 1; iedge <= sbwd->NbEdges(); iedge++) {
+          TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(iedge));
+          aFe->FixVertexTolerance(aEdge);
+          aFe->FixSameParameter(aEdge);
+        }
+      }
+      else if (aFW->StatusGaps3d(ShapeExtend_FAIL)) {
+        Standard_ConstructionError::Raise("Wire construction failed: cannot fix 3d gaps");
+      }
+
       aShape = aFW->WireAPIMake();
     }
   }
@@ -446,7 +467,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
   // Check shape validity
   BRepCheck_Analyzer ana (aShape, false);
   if (!ana.IsValid()) {
-    Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
+    //Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
   }
 
   aFunction->SetValue(aShape);
index 7dd05a5f74285b73598200e59e9dc1781e72e133..7f9f5cab49ba11e64d867dc1e0e6d548276c57b9 100644 (file)
@@ -29,6 +29,7 @@
 #include "GEOM_Object_i.hh"
 
 #include <strstream>
+//#include <sstream>
 
 #include "Utils_CorbaException.hxx"
 #include "OpUtil.hxx"
@@ -326,7 +327,8 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   // Prepare a file name to open
   TCollection_AsciiString aNameWithExt("");
   if (isMultiFile)
-    aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str());
+    aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
+                                                   (theComponent->GetStudy()->URL())).c_str());
   aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
   aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
   // Build a full file name of temporary file
@@ -389,7 +391,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   // Prepare a file name to open
   TCollection_AsciiString aNameWithExt("");
   if (isMultiFile)
-    aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL())).c_str());
+    aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
+                                                   (theComponent->GetStudy()->URL())).c_str());
   aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
   TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
 
@@ -448,14 +451,16 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
 // function : CopyFrom()
 // purpose  :
 //============================================================================
-SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
+SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID)
+{
   // Declare a sequence of the byte to store the copied object
   SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
 
   // Try to get GEOM_Object object by given SObject
   SALOMEDS::GenericAttribute_var anAttr;
   if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return aStreamFile._retn();
-  GEOM::GEOM_Object_var anObject =  GEOM::GEOM_Object::_narrow(_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value()));
+  GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow
+    (_orb->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value()));
   if (anObject->_is_nil()) return aStreamFile._retn();
 
   aStreamFile = anObject->GetShapeStream();
@@ -1360,7 +1365,7 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
     aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
   }
   
-  char* aTypeInfo = "Object";
+  const char* aTypeInfo = "Object";
   if ( !aGeomObject->_is_nil() ) {
     GEOM::GEOM_IKindOfShape::shape_kind aKind;
     GEOM::ListOfLong_var anInts;
index 504f111fa4d58cf2185ea06c21fc11688d57966e..7013c56fd24c7ffb1e85530b4fc82b70c8101e6f 100644 (file)
@@ -30,6 +30,7 @@
 #include "GEOM_Engine.hxx"
 #include "GEOM_Object.hxx"
 
+#include <TopAbs.hxx>
 #include <TColStd_HSequenceOfTransient.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 
@@ -90,7 +91,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdge
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
-                                      (const GEOM::ListOfGO& theEdgesAndWires)
+                           (const GEOM::ListOfGO& theEdgesAndWires,
+                            const CORBA::Double   theTolerance)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -110,7 +112,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeWire
 
   // Make Solid
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeWire(aShapes);
+    GetOperations()->MakeWire(aShapes, theTolerance);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -554,13 +556,7 @@ char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theSha
 //=============================================================================
 CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theShape)
 {
-  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
-  if (aShape.IsNull()) return -1;
-
-  CORBA::Long aNb = GetOperations()->NumberOfFaces(aShape);
-  if (!GetOperations()->IsDone()) return -1;
-
-  return aNb;
+  return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_FACE));
 }
 
 //=============================================================================
@@ -569,11 +565,22 @@ CORBA::Long GEOM_IShapesOperations_i::NumberOfFaces (GEOM::GEOM_Object_ptr theSh
  */
 //=============================================================================
 CORBA::Long GEOM_IShapesOperations_i::NumberOfEdges (GEOM::GEOM_Object_ptr theShape)
+{
+  return NumberOfSubShapes(theShape, Standard_Integer(TopAbs_EDGE));
+}
+
+//=============================================================================
+/*!
+ *  NumberOfSubShapes
+ */
+//=============================================================================
+CORBA::Long GEOM_IShapesOperations_i::NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
+                                                         const CORBA::Long     theShapeType)
 {
   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return -1;
 
-  CORBA::Long aNb = GetOperations()->NumberOfEdges(aShape);
+  CORBA::Long aNb = GetOperations()->NumberOfSubShapes(aShape, theShapeType);
   if (!GetOperations()->IsDone()) return -1;
 
   return aNb;
index 2b15239185a3f2651fb04461708ed25c726fc2c2..61747cc3662faac98d93c5041f6d3cbcf6d8c2ad 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #ifndef _GEOM_IShapesOperations_i_HeaderFile
 #define _GEOM_IShapesOperations_i_HeaderFile
 
@@ -45,7 +45,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
   GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
                                  GEOM::GEOM_Object_ptr thePnt2);
 
-  GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires);
+  GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires,
+                                  const CORBA::Double   theTolerance);
 
   GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
                                  CORBA::Boolean  isPlanarWanted);
@@ -63,7 +64,7 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
 
   GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
                                       CORBA::Double         theTolerance,
-                                          CORBA::Boolean  doKeepNonSolids);
+                                       CORBA::Boolean        doKeepNonSolids);
 
   GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
                                CORBA::Double         theTolerance);
@@ -95,6 +96,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
 
   CORBA::Long NumberOfFaces (GEOM::GEOM_Object_ptr theShape);
   CORBA::Long NumberOfEdges (GEOM::GEOM_Object_ptr theShape);
+  CORBA::Long NumberOfSubShapes (GEOM::GEOM_Object_ptr theShape,
+                                 const CORBA::Long     theShapeType);
 
   GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theShape);
 
index 12ea73a99a2b5b5086206ceb85ae1597cbd72f38..6aee4454c34d3ebf3e8160dc7d1bba071acd1a94 100644 (file)
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #include <Standard_OStream.hxx>
 
 #include <GEOM_Object_i.hh>
-//#include <GEOM_Gen_i.hh>
 #include <GEOM_ISubShape.hxx>
 #include <GEOMImpl_Types.hxx>
 
 #include "utilities.h"
 #include <fstream>
 #include <strstream>
+//#include <sstream>
 
 #include <OpUtil.hxx>
 #include <Utils_ExceptHandlers.hxx>
index 8d9dd32726cedec8cf71203517f8d7c2b790862c..a5e8efb38c80547e1a38aee3f7f8124791a85bcb 100644 (file)
@@ -1886,14 +1886,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
 //=============================================================================
 //  MakeWire:
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires)
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires,
+                                               CORBA::Double       theTolerance)
 {
   beginService( " GEOM_Superv_i::MakeWire" );
   MESSAGE("GEOM_Superv_i::MakeWire");
   if (GEOM_List_i<GEOM::ListOfGO>* aListImplEW = 
       dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(theEdgesAndWires, myPOA).in())) {
     getShapesOp();
-    GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList());
+    GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeWire(aListImplEW->GetList(), theTolerance);
     endService( " GEOM_Superv_i::MakeWire" );
     return anObj;
   }
index e5c37fe14cbe932402b61752b754ab1cf9291231..da63e23662dd924b85c8e68dcbd4cd958019f71d 100644 (file)
@@ -438,7 +438,8 @@ public:
   //-----------------------------------------------------------//
   GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
                                  GEOM::GEOM_Object_ptr thePnt2);
-  GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires);
+  GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires,
+                                  CORBA::Double       theTolerance);
   GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
                                  CORBA::Boolean isPlanarWanted);
   GEOM::GEOM_Object_ptr MakeFaceWires (GEOM::GEOM_List_ptr theWires,
index f1da607014c25c0e4e0a1dfcb862658faafcc661..ef5e604fa34336734deab9ebcdd5443aacdb21ae 100644 (file)
@@ -203,16 +203,23 @@ def TestOtherOperations (geompy, math):
                                    [f_ind_1, f_ind_2, f_ind_3])
   id_MakeChamfer = geompy.addToStudy(MakeChamfer, "MakeChamfer")
 
-  # NumberOfFaces
+  # NumberOf
   NumberOfFaces = geompy.NumberOfFaces(Box)
   if NumberOfFaces != 6:
     print "Bad number of faces in BOX!"
 
-  # NumberOfEdges
   NumberOfEdges = geompy.NumberOfEdges(Box)
   if NumberOfEdges != 12:
     print "Bad number of edges in BOX!"
 
+  NumberOfSolids = geompy.NumberOfSolids(Box)
+  if NumberOfSolids != 1:
+    print "Bad number of solids in BOX!"
+
+  NumberOfShapes = geompy.NumberOfSubShapes(Box, geompy.ShapeType["SHAPE"])
+  if NumberOfShapes != 34:
+    print "Bad number of shapes in BOX!"
+
   # MakeBlockExplode
   Compound = geompy.MakeCompound([Box, Sphere])
   MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6)
index 72beea22a7f0922629272d1a76b1b5874a6c541e..eac732fd843f10d75c6c86d97c95aab7ac857d12 100644 (file)
@@ -1388,12 +1388,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
 
         ## Create a wire from the set of edges and wires.
         #  @param theEdgesAndWires List of edges and/or wires.
+        #  @param theTolerance Maximum distance between vertices, that will be merged.
+        #                      Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
         #  @return New GEOM_Object, containing the created wire.
         #
         #  @ref tui_creation_wire "Example"
-        def MakeWire(self,theEdgesAndWires):
+        def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
             # Example: see GEOM_TestAll.py
-            anObj = self.ShapesOp.MakeWire(theEdgesAndWires)
+            anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
             RaiseIfFailed("MakeWire", self.ShapesOp)
             return anObj
 
@@ -1475,8 +1477,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to count faces of.
         #  @return Quantity of faces.
         #
-        #  @ref swig_NumberOfFaces "Example"
-        def NumberOfFaces(self,theShape):
+        #  @ref swig_NumberOf "Example"
+        def NumberOfFaces(self, theShape):
             # Example: see GEOM_TestOthers.py
             nb_faces = self.ShapesOp.NumberOfFaces(theShape)
             RaiseIfFailed("NumberOfFaces", self.ShapesOp)
@@ -1486,13 +1488,36 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to count edges of.
         #  @return Quantity of edges.
         #
-        #  @ref swig_NumberOfEdges "Example"
-        def NumberOfEdges(self,theShape):
+        #  @ref swig_NumberOf "Example"
+        def NumberOfEdges(self, theShape):
             # Example: see GEOM_TestOthers.py
             nb_edges = self.ShapesOp.NumberOfEdges(theShape)
             RaiseIfFailed("NumberOfEdges", self.ShapesOp)
             return nb_edges
 
+        ## Gives quantity of subshapes of type theShapeType in the given shape.
+        #  @param theShape Shape to count subshapes of.
+        #  @param theShapeType Type of subshapes to count.
+        #  @return Quantity of subshapes of given type.
+        #
+        #  @ref swig_NumberOf "Example"
+        def NumberOfSubShapes(self, theShape, theShapeType):
+            # Example: see GEOM_TestOthers.py
+            nb_ss = self.ShapesOp.NumberOfSubShapes(theShape, theShapeType)
+            RaiseIfFailed("NumberOfSubShapes", self.ShapesOp)
+            return nb_ss
+
+        ## Gives quantity of solids in the given shape.
+        #  @param theShape Shape to count solids in.
+        #  @return Quantity of solids.
+        #
+        #  @ref swig_NumberOf "Example"
+        def NumberOfSolids(self, theShape):
+            # Example: see GEOM_TestOthers.py
+            nb_solids = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["SOLID"])
+            RaiseIfFailed("NumberOfSolids", self.ShapesOp)
+            return nb_solids
+
         # end of l2_measure
         ## @}