Pb: sub-mesh becomes invalid upon adding fillet to a sketch

This commit is contained in:
eap 2020-04-02 13:01:51 +03:00
parent e7ac767896
commit ed5c94eda8

View File

@ -2097,6 +2097,12 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData, int how )
{ {
CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO ); CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( geomObj ); GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( geomObj );
if ( geom->_is_nil() ) return newShape;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( geom );
CORBA::String_var groupIOR = geomGen->GetStringFromIOR( geom );
if ( GEOM_Client* geomClient = _gen_i->GetShapeReader() )
geomClient->RemoveShapeFromBuffer( groupIOR.in() );
newShape = _gen_i->GeomObjectToShape( geom ); newShape = _gen_i->GeomObjectToShape( geom );
if ( !newShape.IsNull() ) if ( !newShape.IsNull() )
{ {
@ -2392,7 +2398,7 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps )); ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps ));
} }
std::map< std::set<int>, int > ii2iMap; // group sub-ids to group id in SMESHDS std::multimap< std::set<int>, int > ii2iMap; // group sub-ids to group id in SMESHDS
// count shapes excluding compounds corresponding to geom groups // count shapes excluding compounds corresponding to geom groups
int oldNbSubShapes = meshDS->MaxShapeIndex(); int oldNbSubShapes = meshDS->MaxShapeIndex();
@ -2431,9 +2437,14 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
for ( ; data != _geomGroupData.end(); ++data ) for ( ; data != _geomGroupData.end(); ++data )
{ {
int oldID = 0; int oldID = 0;
std::map< std::set<int>, int >::iterator ii2i = ii2iMap.find( data->_indices ); std::multimap< std::set<int>, int >::iterator ii2i = ii2iMap.find( data->_indices );
if ( ii2i != ii2iMap.end() ) if ( ii2i != ii2iMap.end() )
{
oldID = ii2i->second; oldID = ii2i->second;
ii2iMap.erase( ii2i );
}
if ( !oldID && data->_indices.size() == 1 )
oldID = *data->_indices.begin();
if ( old2newIDs.count( oldID )) if ( old2newIDs.count( oldID ))
continue; continue;
@ -2498,6 +2509,8 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
g->GetGroupDS()->SetColor( data._color ); g->GetGroupDS()->SetColor( data._color );
} }
if ( !sameTopology )
{
std::map< int, int >::iterator o2n = old2newIDs.begin(); std::map< int, int >::iterator o2n = old2newIDs.begin();
for ( ; o2n != old2newIDs.end(); ++o2n ) for ( ; o2n != old2newIDs.end(); ++o2n )
{ {
@ -2516,6 +2529,7 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
if ( newID > 0 ) if ( newID > 0 )
_mapSubMesh_i [ newID ]->changeLocalId( newID ); _mapSubMesh_i [ newID ]->changeLocalId( newID );
} }
}
// update _mapSubMesh // update _mapSubMesh
std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin(); std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();