From 81dd6293459d01b01db558596cd0232f17d958df Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 17 Jan 2020 20:43:01 +0300 Subject: [PATCH] Fix sub-mesh creation by selection of mesh element + remove dead actors after BreakLink --- src/SMESHGUI/SMESHGUI.cxx | 9 ++++++++- src/SMESH_I/SMESH_Gen_i.cxx | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 6d875cfd2..fb1e7ad93 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1419,9 +1419,16 @@ namespace geomGen = GEOM::GEOM_Gen::_narrow(comp); } } - if (!CORBA::is_nil(geomGen)) { + if (!CORBA::is_nil(geomGen)) + { geomGen->BreakLink(aREntry.toStdString().c_str()); SMESHGUI::GetSMESHGUI()->updateObjBrowser(); + + // remove actors whose objects are removed by BreakLink() + QList wndList = SMESHGUI::desktop()->windows(); + SUIT_ViewWindow* wnd; + foreach(wnd, wndList) + SMESH::UpdateActorsAfterUpdateStudy(wnd); } } } diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 2255f5823..334fc10ee 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -2328,7 +2328,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh, GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID); if ( !geom->_is_nil() ) { 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 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 ); // 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 ); 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 SMESH_Mesh_i* meshServant = SMESH::DownCast( theMesh ); @@ -2415,7 +2415,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh, } if ( !it->_is_nil() ) { for ( it->InitEx(true); it->More(); it->Next() ) { - SALOMEDS::SObject_wrap so = it->Value(); + SALOMEDS::SObject_wrap so = it->Value(); CORBA::Object_var obj = SObjectToObject( so ); GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj ); if ( !subGeom->_is_nil() ) { -- 2.39.2