- SMESH::SMESH_Mesh_var aMesh;
- SMESH::SMESH_subMesh_var aSubMesh;
- Handle(SALOME_InteractiveObject) IObject = selected.First();
- if (IObject->hasEntry()){
- _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
- GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
- if ( aShapeObject->_is_nil() ) {
- // imported mesh
- break;
- }
- if( aMeshSObj ) {
- SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
-
- if (!aMesh->_is_nil()){
- GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
- if (!refShapeObject->_is_nil()) {
- if(!GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
- SUIT_MessageBox::warn1(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_MISSING_PARAMETERS"),
- tr("SMESH_BUT_OK"));
- break;
- }
- try{
- if (GetSMESHGen()->Compute(aMesh,refShapeObject))
- SMESH::ModifiedMesh(aMeshSObj,true);
- // TO Do : change icon of all submeshes
- else
- SUIT_MessageBox::warn1(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_COMPUTE_FAILED"),
- tr("SMESH_BUT_OK"));
- }
- catch(const SALOME::SALOME_Exception & S_ex){
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- }
- }
- }else if(!aSubMesh->_is_nil()){
- aMesh = aSubMesh->GetFather();
- GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
- if(!refShapeObject->_is_nil()){
- bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
- if(!compute){
- SUIT_MessageBox::warn1(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_MISSING_PARAMETERS"),
- tr("SMESH_BUT_OK"));
- break;
- }
- try{
- if ( GetSMESHGen()->Compute(aMesh,refShapeObject) )
- SMESH::ModifiedMesh(aMeshSObj,true);
- // TO Do : change icon of all submeshes
- else
- SUIT_MessageBox::warn1(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_COMPUTE_FAILED"),
- tr("SMESH_BUT_OK"));
- }catch(const SALOME::SALOME_Exception & S_ex){
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- }
- }
- }
- }
- }
- CORBA::Long anId = aStudy->StudyId();
- TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
- if ( automaticUpdate() && aVisualObj){
- aVisualObj->Update();
- SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
- if(!anActor){
- anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
- if(anActor){
- SMESH::DisplayActor(view,anActor); //apo
- SMESH::FitAll();
- }
- }
- SMESH::RepaintCurrentView();
- }
- }else{
- SUIT_MessageBox::warn1(desktop(),
- tr("SMESH_WRN_WARNING"),
- tr("SMESH_WRN_VIEWER_VTK"),
- tr("SMESH_BUT_OK"));
- }
- updateObjBrowser();
- break;