Fix sub-mesh creation by selection of mesh element + remove dead actors after BreakLink

This commit is contained in:
eap 2020-01-17 20:43:01 +03:00
parent af067a707e
commit 81dd629345
2 changed files with 12 additions and 5 deletions

View File

@ -1419,9 +1419,16 @@ namespace
geomGen = GEOM::GEOM_Gen::_narrow(comp); geomGen = GEOM::GEOM_Gen::_narrow(comp);
} }
} }
if (!CORBA::is_nil(geomGen)) { if (!CORBA::is_nil(geomGen))
{
geomGen->BreakLink(aREntry.toStdString().c_str()); geomGen->BreakLink(aREntry.toStdString().c_str());
SMESHGUI::GetSMESHGUI()->updateObjBrowser(); SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// remove actors whose objects are removed by BreakLink()
QList<SUIT_ViewWindow*> wndList = SMESHGUI::desktop()->windows();
SUIT_ViewWindow* wnd;
foreach(wnd, wndList)
SMESH::UpdateActorsAfterUpdateStudy(wnd);
} }
} }
} }

View File

@ -2328,7 +2328,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID); GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) { if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh(); GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine( geom ); GEOM::GEOM_Gen_var geomGen = GetGeomEngine( geom );
// try to find the corresponding SObject // try to find the corresponding SObject
SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() ); SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() );
@ -2359,7 +2359,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
} }
} }
} }
if ( SObj->_is_nil() ) // publish a new subshape if ( SObj->_is_nil() && !geomGen->_is_nil() ) // publish a new subshape
SObj = geomGen->AddInStudy( geom, theGeomName, mainShape ); SObj = geomGen->AddInStudy( geom, theGeomName, mainShape );
// return only published geometry // return only published geometry
@ -2392,7 +2392,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh(); GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine( mainShape ); GEOM::GEOM_Gen_var geomGen = GetGeomEngine( mainShape );
// get a core mesh DS // get a core mesh DS
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ); SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );