From 4a3d652a69426daf21bfab3bf950e03665660e2a Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 11 Mar 2020 19:57:24 +0300 Subject: [PATCH] #18835 Automatically create groups on Geometry in SMESH when the SHAPER result is modified --- src/SMESH_I/SMESH_Mesh_i.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index aa25d7d07..0f4dd5407 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -2422,7 +2422,8 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink ) if ( ii2i != ii2iMap.end() ) oldID = ii2i->second; - TopoDS_Shape newShape = newGroupShape( *data, isBreakLink ? IS_BREAK_LINK : MAIN_TRANSFORMED ); + int how = ( isBreakLink || !sameTopology ) ? IS_BREAK_LINK : MAIN_TRANSFORMED; + TopoDS_Shape newShape = newGroupShape( *data, how ); if ( !newShape.IsNull() ) { if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape @@ -2441,12 +2442,12 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink ) // re-assign hypotheses for ( size_t i = 0; i < ids2Hyps.size(); ++i ) { - if ( !sameTopology && ids2Hyps[i].first != 1 ) - continue; // assign only global hypos int sID = ids2Hyps[i].first; std::map< int, int >::iterator o2n = old2newIDs.find( sID ); if ( o2n != old2newIDs.end() ) sID = o2n->second; + else if ( sID != 1 ) + continue; const TopoDS_Shape& s = meshDS->IndexToShape( sID ); const THypList& hyps = ids2Hyps[i].second; THypList::const_iterator h = hyps.begin(); @@ -2454,12 +2455,6 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink ) _impl->AddHypothesis( s, (*h)->GetID() ); } - if ( !sameTopology ) - { - // remove invalid study sub-objects - CheckGeomGroupModif(); - } - else { // restore groups on geometry for ( size_t i = 0; i < groupsData.size(); ++i ) @@ -2506,6 +2501,12 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink ) i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first )); } + if ( !sameTopology ) + { + // remove invalid study sub-objects + CheckGeomGroupModif(); + } + _gen_i->UpdateIcons( me ); if ( !isBreakLink && isShaper ) -- 2.30.2