Salome HOME
#29335 [CEA 29224] Cannot graphicaly select geometry to create groups: implement...
authorrnv <rnv@opencascade.com>
Thu, 24 Mar 2022 12:17:55 +0000 (15:17 +0300)
committerrnv <rnv@opencascade.com>
Thu, 24 Mar 2022 12:17:55 +0000 (15:17 +0300)
src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx
src/SMESHGUI/SMESHGUI_GEOMGenUtils.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx

index 57fce1eea0c252d7f8f55c4000144c7fe18bcf12..e865168d182cc61b47ae9eae61143d2fb596f313 100644 (file)
@@ -276,12 +276,15 @@ namespace SMESH
   //================================================================================
 
   bool ContainsSubShape( GEOM::GEOM_Object_ptr mainGeom,
   //================================================================================
 
   bool ContainsSubShape( GEOM::GEOM_Object_ptr mainGeom,
-                         GEOM::GEOM_Object_ptr subGeom )
+                         GEOM::GEOM_Object_ptr subGeom, bool allowMainShape )
   {
     if ( CORBA::is_nil( mainGeom ) ||
          CORBA::is_nil( subGeom ))
       return false;
 
   {
     if ( CORBA::is_nil( mainGeom ) ||
          CORBA::is_nil( subGeom ))
       return false;
 
+    if (allowMainShape && mainGeom->IsSame(subGeom))
+      return true;
+
     GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
     if ( geomGen->_is_nil() ) return false;
 
     GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
     if ( geomGen->_is_nil() ) return false;
 
index 04e8bfd93a8525b0a16b6849bf3e325ee31dbd04..f261c5248a286b9a85f96ed58d975571ab97456d 100644 (file)
@@ -61,7 +61,8 @@ namespace SMESH
                                        QString& subGeom, QString& meshGeom);
 
   SMESHGUI_EXPORT bool ContainsSubShape( GEOM::GEOM_Object_ptr mainShape,
                                        QString& subGeom, QString& meshGeom);
 
   SMESHGUI_EXPORT bool ContainsSubShape( GEOM::GEOM_Object_ptr mainShape,
-                                         GEOM::GEOM_Object_ptr subShape );
+                                         GEOM::GEOM_Object_ptr subShape,
+                                         bool allowMainShape = true );
 }
 
 #endif // SMESHGUI_GEOMGENUTILS_H
 }
 
 #endif // SMESHGUI_GEOMGENUTILS_H
index e0c88fa1788b406a782cd7b5257525d3fa359545..5b2f605a16159e8ccdb10c52769cbc64d81a1783 100644 (file)
@@ -355,7 +355,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
     GEOM::GEOM_Object_var subGeom =
       GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
 
     GEOM::GEOM_Object_var subGeom =
       GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
 
-    if ( SMESH::ContainsSubShape( mainGeom, subGeom ))
+    if ( SMESH::ContainsSubShape( mainGeom, subGeom, false ))
       return true;
   }
 
       return true;
   }