#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.

This commit is contained in:
rnv 2022-03-24 15:17:55 +03:00
parent 0510c0d369
commit 64547701f8
3 changed files with 7 additions and 3 deletions

View 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 ) || if ( CORBA::is_nil( mainGeom ) ||
CORBA::is_nil( subGeom )) CORBA::is_nil( subGeom ))
return false; return false;
if (allowMainShape && mainGeom->IsSame(subGeom))
return true;
GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
if ( geomGen->_is_nil() ) return false; if ( geomGen->_is_nil() ) return false;

View File

@ -61,7 +61,8 @@ namespace SMESH
QString& subGeom, QString& meshGeom); QString& subGeom, QString& meshGeom);
SMESHGUI_EXPORT bool ContainsSubShape( GEOM::GEOM_Object_ptr mainShape, 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

View File

@ -355,7 +355,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object_var subGeom =
GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
if ( SMESH::ContainsSubShape( mainGeom, subGeom )) if ( SMESH::ContainsSubShape( mainGeom, subGeom, false ))
return true; return true;
} }