From: rnv Date: Thu, 24 Mar 2022 12:17:55 +0000 (+0300) Subject: #29335 [CEA 29224] Cannot graphicaly select geometry to create groups: implement... X-Git-Tag: V9_9_0a2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=64547701f88feb4674ba0edb6c8fa0164c0002ee #29335 [CEA 29224] Cannot graphicaly select geometry to create groups: implement possibility to select whole object (on which mesh was constructed) as a base for Mesh group. --- diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx index 57fce1eea..e865168d1 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx @@ -276,12 +276,15 @@ namespace SMESH //================================================================================ 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 (allowMainShape && mainGeom->IsSame(subGeom)) + return true; + GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); if ( geomGen->_is_nil() ) return false; diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h index 04e8bfd93..f261c5248 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h @@ -61,7 +61,8 @@ namespace SMESH 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 diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index e0c88fa17..5b2f605a1 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -355,7 +355,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const 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; }