]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
EDF - GetShapesOnShape incomplete eksu/42081GetShapesOnShape 23/head
authorEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Thu, 6 Jun 2024 14:30:31 +0000 (15:30 +0100)
committerEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Tue, 25 Jun 2024 13:50:11 +0000 (14:50 +0100)
Make it possible to set Tolerance as a parameter in GetShapesOnShape geompy function

16 files changed:
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/AdvancedEngine/AdvancedEngine_IOperations.cxx
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/GEOMGUI/GEOM_msg_ja.ts
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/geomBuilder.py
src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx
src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.h

index d1428637a75e00fa1f489ad69c213e6658e749bb..f6185385993c275b0c234ad72977c2ebdd189d18 100644 (file)
@@ -2664,12 +2664,14 @@ module GEOM
      * \param theShape - the shape to explore
      * \param theShapeType - type of sub-shape of theShape
      * \param theState - required state
+     * \param theTolerance - tolerance
      * \return List of IDs of all found sub-shapes.
      */
     ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape,
                                     in GEOM_Object theShape,
                                     in short       theShapeType,
-                                    in shape_state theState);
+                                    in shape_state theState,
+                                    in double      theTolerance);
 
     /*!
      * \brief Find sub-shapes complying with given status
@@ -2677,12 +2679,14 @@ module GEOM
      * \param theShape - the shape to explore
      * \param theShapeType - type of sub-shape of theShape
      * \param theState - required state
+     * \param theTolerance - tolerance
      * \return List of all found sub-shapes.
      */
     ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape,
                                in GEOM_Object theShape,
                                in short       theShapeType,
-                               in shape_state theState);
+                               in shape_state theState,
+                               in double      theTolerance);
 
     /*!
      * \brief Find sub-shapes complying with given status
@@ -2690,12 +2694,14 @@ module GEOM
      * \param theShape - the shape to explore
      * \param theShapeType - type of sub-shape of theShape
      * \param theState - required state
+     * \param theTolerance - tolerance
      * \return compound includes all found sub-shapes.
      */
     GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
                                             in GEOM_Object theShape,
                                             in short       theShapeType,
-                                            in shape_state theState);
+                                            in shape_state theState,
+                                            in double      theTolerance);
 
     /*!
      *  \brief Get sub-shape(s) of \a theShapeWhere, which are
index 0f6ddc0f91ce9e1f82e838c9c6c36d6222851dc5..3338268523effd1fd6e995c43849b37abbb3fac2 100644 (file)
@@ -413,11 +413,13 @@ module GEOM
     GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape,
                                 in GEOM_Object theShape,
                                 in short       theShapeType,
-                                in shape_state theState);
+                                in shape_state theState,
+                                in double      theTolerance);
     GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
                                             in GEOM_Object theShape,
                                             in short       theShapeType,
-                                            in shape_state theState);
+                                            in shape_state theState,
+                                            in double      theTolerance);
 
     //-----------------------------------------------------------//
     // BlocksOperations                                          //
index d43f449520172eac7182b68837b4f9834b9a6236..edfa89e163dad8586ac0a5447cab12073f7a8332 100644 (file)
@@ -396,7 +396,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1);
     if (junctionFaces1.IsNull())
       junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound
-        (aPln1, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        (aPln1, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN, Precision::Confusion());
     if (!junctionFaces1.IsNull()) {
       junctionFaces1->GetLastFunction()->SetDescription("");
       junctionFaces1->SetName("JUNCTION_FACE_1");
@@ -410,7 +410,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2);
     if (junctionFaces2.IsNull())
       junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound
-        (aPln2, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        (aPln2, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN, Precision::Confusion());
     if (!junctionFaces2.IsNull()) {
       junctionFaces2->GetLastFunction()->SetDescription("");
       junctionFaces2->SetName("JUNCTION_FACE_2");
@@ -424,7 +424,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
     Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3);
     if (junctionFaces3.IsNull())
       junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound
-        (aPln3, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        (aPln3, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN, Precision::Confusion());
     if (!junctionFaces3.IsNull()) {
       junctionFaces3->GetLastFunction()->SetDescription("");
       junctionFaces3->SetName("JUNCTION_FACE_3");
index 41c3fa5de4dc3230d24afcc2ac27d5f27a56d54c..4d4fdc97256a652867d62b638b05f8152e77dac7 100644 (file)
@@ -5279,6 +5279,10 @@ Please, select face, shell or solid and try again</translation>
     <message>
         <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
         <translation>State</translation>
+    </message>
+        <message>
+        <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+        <translation>Tolerance</translation>
     </message>
     <message>
         <source>GEOM_KIND_OF_SHAPE</source>
index 6605a135e88e8ad43c1ab371afc2661607effab4..199ae0ef30e0a887924c71633bb73c5d26ff0fe2 100644 (file)
@@ -5272,6 +5272,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
         <translation>Etat</translation>
     </message>
+    <message>
+        <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+        <translation>Tolérance </translation>
+    </message>
     <message>
         <source>GEOM_KIND_OF_SHAPE</source>
         <translation>Type d&apos;objet :</translation>
index 46a0ea1353fe5fe6378712c5ade423a8f1c0f523..1db4574487009be726df7c6e656f4262d27346f2 100644 (file)
       <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
       <translation>状態</translation>
     </message>
+    <message>
+      <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+      <translation>公差</translation>
+    </message>
     <message>
       <source>GEOM_KIND_OF_SHAPE</source>
       <translation>形状の種類:</translation>
index edc8d56fdd4fa415ed6f14534494d9c86317e45a..08a9a6d0fb67d191bda81dae18bf0f7a94f41c51 100644 (file)
@@ -2901,7 +2901,8 @@ Handle(TColStd_HSequenceOfInteger)
                                  (const Handle(GEOM_Object)& theCheckShape,
                                   const Handle(GEOM_Object)& theShape,
                                   const Standard_Integer theShapeType,
-                                  GEOMAlgo_State theState)
+                                  GEOMAlgo_State theState,
+                                  const Standard_Real theTolerance)
 {
   Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
 
@@ -2917,7 +2918,7 @@ Handle(TColStd_HSequenceOfInteger)
 
   // Compute classification tolerance.
   TopTools_IndexedMapOfShape aMapVtx;
-  Standard_Real              aTol = Precision::Confusion();
+  Standard_Real aTol = theTolerance;
 
   TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapVtx);
 
@@ -3010,10 +3011,11 @@ Handle(TColStd_HSequenceOfInteger)
                             (const Handle(GEOM_Object)& theCheckShape,
                              const Handle(GEOM_Object)& theShape,
                              const Standard_Integer theShapeType,
-                             GEOMAlgo_State theState)
+                             GEOMAlgo_State theState,
+                             const Standard_Real theTolerance)
 {
   Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
-    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
 
   if ( aSeqOfIDs.IsNull()  || aSeqOfIDs->Length() == 0 )
     return NULL;
@@ -3030,7 +3032,8 @@ Handle(TColStd_HSequenceOfInteger)
     << theCheckShape << ", "
     << theShape << ", "
     << TopAbs_ShapeEnum(theShapeType) << ", "
-    << theState << ")";
+    << theState << ", " 
+    << theTolerance << ")";
 #endif // DUMP_SUBSHAPE_IDS
 
   SetErrorCode(OK);
@@ -3053,10 +3056,11 @@ Handle(TColStd_HSequenceOfTransient)
                              (const Handle(GEOM_Object)& theCheckShape,
                               const Handle(GEOM_Object)&  theShape,
                               const Standard_Integer theShapeType,
-                              GEOMAlgo_State theState)
+                              GEOMAlgo_State theState,
+                              const Standard_Real theTolerance)
 {
   Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
-    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
   if ( aSeqOfIDs.IsNull()  || aSeqOfIDs->Length() == 0 )
     return NULL;
 
@@ -3078,7 +3082,8 @@ Handle(TColStd_HSequenceOfTransient)
     << theCheckShape << ", "
     << theShape << ", "
     << TopAbs_ShapeEnum(theShapeType) << ", "
-    << theState << ")";
+    << theState << ", " 
+    << theTolerance << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -3089,12 +3094,13 @@ Handle(TColStd_HSequenceOfTransient)
 //=======================================================================
 Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
                              (const Handle(GEOM_Object)& theCheckShape,
-                              const Handle(GEOM_Object)&  theShape,
+                              const Handle(GEOM_Object)& theShape,
                               const Standard_Integer theShapeType,
-                              GEOMAlgo_State theState)
+                              GEOMAlgo_State theState,
+                              const Standard_Real theTolerance)
 {
   Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
-    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+    getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
 
   if ( aSeqOfIDs.IsNull()  || aSeqOfIDs->Length() == 0 )
     return NULL;
@@ -3137,8 +3143,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
     << theCheckShape << ", "
     << theShape << ", "
     << TopAbs_ShapeEnum(theShapeType) << ", "
-    << theState << ")";
-
+    << theState << ", " 
+    << theTolerance << ")";
   SetErrorCode(OK);
 
   return aRes;
index dc352ba585e11261f1ec7883874fba9b7204d03e..1dd9b1e023866278172ca04b5e07c7ecc4838a68 100644 (file)
@@ -397,13 +397,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
    * \param theShape - the shape to explore
    * \param theShapeType - type of sub-shape of theShape
    * \param theState - required state
+   * \param theTolerance - tolerance
    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
    */
   Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
                    GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
                                        const Handle(GEOM_Object)& theShape,
                                        const Standard_Integer theShapeType,
-                                       GEOMAlgo_State theState);
+                                       GEOMAlgo_State theState,
+                                       const Standard_Real theTolerance);
 
   /*!
    * \brief Find sub-shapes complying with given status about surface
@@ -411,18 +413,21 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
    * \param theShape - the shape to explore
    * \param theShapeType - type of sub-shape of theShape
    * \param theState - required state
+   * \param theTolerance - tolerance
    * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
    */
   Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
                       GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
                                        const Handle(GEOM_Object)& theShape,
                                        const Standard_Integer theShapeType,
-                                       GEOMAlgo_State theState);
+                                       GEOMAlgo_State theState,
+                                       const Standard_Real theTolerance);
   Standard_EXPORT Handle(GEOM_Object)
             GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
                                        const Handle(GEOM_Object)& theShape,
                                        const Standard_Integer theShapeType,
-                                       GEOMAlgo_State theState);
+                                       GEOMAlgo_State theState,
+                                       const Standard_Real theTolerance);
 
   /*!
    * \brief Resize the input edge with the new Min and Max parameters.
@@ -628,7 +633,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
                                       (const Handle(GEOM_Object)& theCheckShape,
                                        const Handle(GEOM_Object)& theShape,
                                        const Standard_Integer theShapeType,
-                                       GEOMAlgo_State theState);
+                                       GEOMAlgo_State theState,
+                                       const Standard_Real theTolerance);
 
   /*!
    * \brief Find shape objects and their entries by their ids
index 18d4ca581f67112101dcc18c928885679a062972..96ab9cdb40b932703c8aac403be17ec9f48da65b 100644 (file)
@@ -1188,7 +1188,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
           {
             // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
             aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
-              (short)GEOM::SOLID, GEOM::ST_ONIN);
+              (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
           }
           break;
         case GEOM::FSM_GetInPlaceByHistory:
@@ -1469,7 +1469,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
           {
             // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
             aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
-                                                             (short)GEOM::SOLID, GEOM::ST_ONIN);
+                                                             (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
           }
           break;
         case GEOM::FSM_GetInPlaceByHistory:
@@ -1753,7 +1753,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
           {
             // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
             aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
-              (short)GEOM::SOLID, GEOM::ST_ONIN);
+              (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
           }
           break;
         case GEOM::FSM_GetInPlaceByHistory:
@@ -2032,7 +2032,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
           {
             // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
             aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
-                                                             (short)GEOM::SOLID, GEOM::ST_ONIN);
+                                                             (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
           }
           break;
         case GEOM::FSM_GetInPlaceByHistory:
index 1e02554d7788ac4d7f02ce9cadf5753fe07bd92a..d42816d288bf8b321c75fa3a7ebc04c0dc49af47 100644 (file)
@@ -1850,7 +1850,8 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
                                            (GEOM::GEOM_Object_ptr theCheckShape,
                                             GEOM::GEOM_Object_ptr theShape,
                                             CORBA::Short          theShapeType,
-                                            GEOM::shape_state     theState)
+                                            GEOM::shape_state     theState,
+                                            CORBA::Double         theTolerance)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
 
@@ -1866,7 +1867,7 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
 
   //Get Shapes On Shape
   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
-    (aCheckShape,aShape, theShapeType,ShapeState(theState));
+    (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
 
   if (!GetOperations()->IsDone() || aHSeq.IsNull())
     return aSeq._retn();
@@ -1889,7 +1890,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
                                            (GEOM::GEOM_Object_ptr theCheckShape,
                                             GEOM::GEOM_Object_ptr theShape,
                                             CORBA::Short          theShapeType,
-                                            GEOM::shape_state     theState)
+                                            GEOM::shape_state     theState,
+                                            CORBA::Double         theTolerance)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -1905,7 +1907,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
 
   //Get Shapes On Shape
   Handle(::GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
-    (aCheckShape,aShape, theShapeType,ShapeState(theState));
+    (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
 
   if (anObject.IsNull())
     return aGEOMObject._retn();
@@ -1923,7 +1925,8 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
                                            (GEOM::GEOM_Object_ptr theCheckShape,
                                             GEOM::GEOM_Object_ptr theShape,
                                             CORBA::Short          theShapeType,
-                                            GEOM::shape_state     theState)
+                                            GEOM::shape_state     theState,
+                                            CORBA::Double         theTolerance)
 {
   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
 
@@ -1939,7 +1942,7 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
 
   //Get Shapes On Shape
   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
-    (aCheckShape,aShape, theShapeType,ShapeState(theState));
+    (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
   if (!GetOperations()->IsDone() || aHSeq.IsNull())
     return aSeq._retn();
 
index 2d8cdf36eddaacd4f0a8994062c42c373bc7c67b..f4aa86321f665c1030329f76321f7264b091c66f 100644 (file)
@@ -262,18 +262,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
   GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
                                     GEOM::GEOM_Object_ptr theShape,
                                     CORBA::Short          theShapeType,
-                                    GEOM::shape_state     theState);
+                                    GEOM::shape_state     theState,
+                                    CORBA::Double         theTolerance);
 
   GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
                                    (GEOM::GEOM_Object_ptr theSheckShape,
                                     GEOM::GEOM_Object_ptr theShape,
                                     CORBA::Short          theShapeType,
-                                    GEOM::shape_state     theState);
+                                    GEOM::shape_state     theState,
+                                    CORBA::Double         theTolerance);
 
   GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
                                          GEOM::GEOM_Object_ptr theShape,
                                          CORBA::Short          theShapeType,
-                                         GEOM::shape_state     theState);
+                                         GEOM::shape_state     theState,
+                                         CORBA::Double         theTolerance);
 
   GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
                                     GEOM::GEOM_Object_ptr theShapeWhat);
index c510ec9a376665ab309dcbb48508140e2a27aa82..85a77fa66b258c395b084edb22f5c6d9fbbd66b5 100644 (file)
@@ -2424,13 +2424,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetShapesOnShape
                                           (GEOM::GEOM_Object_ptr theCheckShape,
                                            GEOM::GEOM_Object_ptr theShape,
                                            CORBA::Short theShapeType,
-                                           GEOM::shape_state theState)
+                                           GEOM::shape_state theState,
+                                           CORBA::Double theTolerance)
 {
   beginService( " GEOM_Superv_i::GetShapesOnShape" );
   MESSAGE("GEOM_Superv_i::GetShapesOnShape");
   getShapesOp();
   GEOM::ListOfGO* aList =
-    myShapesOp->GetShapesOnShape(theCheckShape, theShape, theShapeType, theState);
+    myShapesOp->GetShapesOnShape(theCheckShape, theShape, theShapeType, theState, theTolerance);
   GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList));
   MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
   endService( " GEOM_Superv_i::GetShapesOnShape" );
@@ -2445,13 +2446,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetShapesOnShapeAsCompound
                                           (GEOM::GEOM_Object_ptr theCheckShape,
                                            GEOM::GEOM_Object_ptr theShape,
                                            CORBA::Short theShapeType,
-                                           GEOM::shape_state theState)
+                                           GEOM::shape_state theState,
+                                           CORBA::Double theTolerance)
 {
   beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
   MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound");
   getShapesOp();
   GEOM::GEOM_Object_ptr anObj =
-    myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState);
+    myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState, theTolerance);
   endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
   return anObj;
 }
index b07a82e0d2bb0b53f6ebc385d4ed71e4988df19c..61104502925fe822d9c2570184a5c122c2a54d6e 100644 (file)
@@ -528,12 +528,14 @@ public:
   GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape,
                                           GEOM::GEOM_Object_ptr theShape,
                                           CORBA::Short theShapeType,
-                                          GEOM::shape_state theState);
+                                          GEOM::shape_state theState,
+                                          CORBA::Double theTolerance);
   GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
                                        (GEOM::GEOM_Object_ptr theCheckShape,
                                           GEOM::GEOM_Object_ptr theShape,
                                           CORBA::Short theShapeType,
-                                          GEOM::shape_state theState);
+                                          GEOM::shape_state theState,
+                                          CORBA::Double theTolerance);
 
   //-----------------------------------------------------------//
   // BlocksOperations                                          //
index 7cf3edc64a4c34e8b7e9013927a28297bee6263d..fd91f2ae6eb622aac044b05a5ac29fae2a101e54 100644 (file)
@@ -5915,7 +5915,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
-        #
         #  @return List of all found sub-shapes indices.
         #
         #  @ref swig_GetShapesOnBoxIDs "Example"
@@ -5946,6 +5945,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+        #  @param theTol tolerance that can be set by the user
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -5954,7 +5954,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref swig_GetShapesOnShape "Example"
         @ManageTransactions("ShapesOp")
-        def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
+        def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07, theName=None):
             """
             Find in theShape all sub-shapes of type theShapeType,
             situated relatively the specified theCheckShape by the
@@ -5974,7 +5974,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
-                                                   theShapeType, theState)
+                                                   theShapeType, theState, theTol)
             RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
             self._autoPublish(aList, theName, "shapeOnShape")
             return aList
@@ -5986,6 +5986,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+        #  @param theTol tolerance that can be set by the user
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -5994,7 +5995,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref swig_GetShapesOnShapeAsCompound "Example"
         @ManageTransactions("ShapesOp")
-        def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
+        def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07, theName=None):
             """
             Find in theShape all sub-shapes of type theShapeType,
             situated relatively the specified theCheckShape by the
@@ -6014,7 +6015,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
-                                                             theShapeType, theState)
+                                                             theShapeType, theState, theTol)
             RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
             self._autoPublish(anObj, theName, "shapeOnShape")
             return anObj
@@ -6026,12 +6027,13 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+        #  @param theTol tolerance that can be set by the user
         #
         #  @return List of all found sub-shapes indices.
         #
         #  @ref swig_GetShapesOnShapeIDs "Example"
         @ManageTransactions("ShapesOp")
-        def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState):
+        def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07):
             """
             Find in theShape all sub-shapes of type theShapeType,
             situated relatively the specified theCheckShape by the
@@ -6048,7 +6050,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
-                                                      theShapeType, theState)
+                                                      theShapeType, theState, theTol)
             RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
             return aList
 
index da0575b379342450b615902f8ebbd32b0442471a..bcc9a47cee0341d8b1c591135c5b18347b4b3fdc 100644 (file)
 #include <SalomeApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 
+class SalomeApp_DoubleSpinBox;
+
+#define MAX_TOL 0.0001
+#define TOL 1e-07
+
 //==============================================================================
 // class    : OperationGUI_GetShapesOnShapeDlg()
 // purpose  : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
@@ -69,6 +74,11 @@ OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg (GeometryGUI*
   GroupPoints->LineEdit1->setReadOnly(true);
   GroupPoints->LineEdit2->setReadOnly(true);
 
+  QLabel *aTolLbl = new QLabel(tr("GEOM_SHAPES_ON_SHAPE_TOLERANCE"));
+  myTolSpinBox = new SalomeApp_DoubleSpinBox;
+  GroupPoints->gridLayout1->addWidget(aTolLbl, 4, 0);
+  GroupPoints->gridLayout1->addWidget(myTolSpinBox, 4, 1, 1, 2);
+
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
   layout->addWidget(GroupPoints);
@@ -114,6 +124,9 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
   GroupPoints->LineEdit2->clear();
   myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
 
+  initSpinBox(myTolSpinBox, 0., MAX_TOL, TOL, "param_tol_precision");
+  myTolSpinBox->setValue(TOL);
+
   showOnlyPreviewControl();
 
   // signals and slots connections
@@ -132,6 +145,8 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
           this, SLOT(SelectionIntoArgument()));
 
+  connect(myTolSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(processPreview()));
+
   initName(mainFrame()->GroupConstructors->title());
 
   GroupPoints->TextLabel3->show();
@@ -335,7 +350,7 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects)
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
   GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1,
                                                                    (CORBA::Short) aLimit,
-                                                                   aState); // todo: aState must be explicitly initialized to avoid warning (see above)
+                                                                   aState, myTolSpinBox->value()); // todo: aState must be explicitly initialized to avoid warning (see above)
 
   if (!anObj->_is_nil())
     objects.push_back(anObj._retn());
index e416747f710bb262f2f40f56e4e5960cc8971924..a77a6d316632dddb3f78ce8edee08fede8924c1b 100644 (file)
@@ -59,6 +59,7 @@ private:
   GEOMAlgo_State                     myState;
   
   DlgRef_2Sel2List*                  GroupPoints;
+  SalomeApp_DoubleSpinBox*           myTolSpinBox;
 
 private slots:
   void                               ClickOnOk();