SHAPERSTUDY: fix case of a group containing the main shape

This commit is contained in:
eap 2020-04-11 01:22:43 +03:00
parent 52a5308f7c
commit 7406f0680a

View File

@ -957,13 +957,15 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
//Get or Create the SMESH_subMesh object implementation //Get or Create the SMESH_subMesh object implementation
int subMeshId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape ); TopoDS_Iterator it( myLocSubShape );
int subMeshId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
if ( !subMeshId && ! _impl->GetMeshDS()->IsGroupOfSubShapes( myLocSubShape )) bool isValidSub = ( subMeshId || _impl->GetMeshDS()->IsGroupOfSubShapes( myLocSubShape ));
if ( isValidSub && myLocSubShape.ShapeType() == TopAbs_COMPOUND )
isValidSub = !it.Value().IsSame( _impl->GetShapeToMesh() );
if ( !isValidSub )
{ {
TopoDS_Iterator it( myLocSubShape );
if ( it.More() ) if ( it.More() )
THROW_SALOME_CORBA_EXCEPTION("not sub-shape of the main shape", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Not a sub-shape of the main shape", SALOME::BAD_PARAM);
} }
subMesh = getSubMesh( subMeshId ); subMesh = getSubMesh( subMeshId );
@ -2508,11 +2510,14 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
for ( size_t i = 0; i < ids2Hyps.size(); ++i ) for ( size_t i = 0; i < ids2Hyps.size(); ++i )
{ {
int sID = ids2Hyps[i].first; int sID = ids2Hyps[i].first;
std::map< int, int >::iterator o2n = old2newIDs.find( sID ); if ( sID != 1 )
if ( o2n != old2newIDs.end() ) {
sID = o2n->second; std::map< int, int >::iterator o2n = old2newIDs.find( sID );
else if ( !sameTopology && sID != 1 ) if ( o2n != old2newIDs.end() )
continue; sID = o2n->second;
else if ( !sameTopology )
continue;
}
const TopoDS_Shape& s = meshDS->IndexToShape( sID ); const TopoDS_Shape& s = meshDS->IndexToShape( sID );
if ( s.IsNull() ) if ( s.IsNull() )
continue; continue;