- if ( !subMeshId )
+ if ( !subMeshId && ! _impl->GetMeshDS()->IsGroupOfSubShapes( myLocSubShape ))
THROW_SALOME_CORBA_EXCEPTION("not sub-shape of the main shape", SALOME::BAD_PARAM);
//Get or Create the SMESH_subMesh object implementation
int subMeshId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
- if ( !subMeshId )
+ if ( !subMeshId && ! _impl->GetMeshDS()->IsGroupOfSubShapes( myLocSubShape ))
THROW_SALOME_CORBA_EXCEPTION("not sub-shape of the main shape", SALOME::BAD_PARAM);
+
subMesh = getSubMesh( subMeshId );
// create a new subMesh object servant if there is none for the shape