From: eap Date: Fri, 17 Jan 2020 17:43:01 +0000 (+0300) Subject: Fix sub-mesh creation by selection of mesh element + remove dead actors after BreakLink X-Git-Tag: V9_5_0a1~5^2~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=81dd6293459d01b01db558596cd0232f17d958df;p=modules%2Fsmesh.git Fix sub-mesh creation by selection of mesh element + remove dead actors after BreakLink --- 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() ) {