Salome HOME
Merge from PortingMED3 07Apr11
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 308505e8427553693586badc66b6e96837c1117e..581d23ef90e9f20787e79904f867648f1c65cf32 100644 (file)
     else if ( theCommandID == 111 ) {
       filter.append( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" );
     }
+    else if ( theCommandID == 140 ) {
+      filter.append( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
+    }
 
     QString anInitialPath = "";
     if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
       _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
 
       QStringList errors;
+      QStringList anEntryList;
       bool isEmpty = false;
       for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
         QString filename = *it;
               }
               break;
             }
+          case 140:
+            {
+              // STL format
+              aMeshes->length( 1 );
+              aMeshes[0] = theComponentMesh->CreateMeshesFromSTL( filename.toLatin1().constData() );
+              if ( aMeshes[0]->_is_nil() ) {
+                errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+                               arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
+              }
+              break;
+            }
           }
         }
         catch ( const SALOME::SALOME_Exception& S_ex ) {
             if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
               SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
 
+            anEntryList.append( aMeshSO->GetID().c_str() );
+
 #ifdef WITHGENERICOBJ
             // obj has been published in study. Its refcount has been incremented.
             // It is safe to decrement its refcount
             // so that it will be destroyed when the entry in study will be removed
-            aMeshes[i]->Destroy();
+            aMeshes[i]->UnRegister();
 #endif
           }
           else {
       // update Object browser
       SMESHGUI::GetSMESHGUI()->updateObjBrowser();
 
+      // browse to the published meshes
+      if( LightApp_Application* anApp =
+          dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+        anApp->browseObjects( anEntryList );
+
       // show Error message box if there were errors
       if ( errors.count() > 0 ) {
         SUIT_MessageBox::critical( SMESHGUI::desktop(),
         aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)";
       }
       break;
-    case 140:
     case 141:
       {
         // export STL
         /*
           there must be check on others mesh elements not equal triangles
         */
-        if (aMesh->NbTriangles() < 1) {
-          SUIT_MessageBox::warning
-            (SMESHGUI::desktop(),
-             QObject::tr("SMESH_WRN_WARNING"),
-             QObject::tr("SMESH_EXPORT_STL1").arg(aMeshName));
-          return;
-        }
-        if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
-          int aRet = SUIT_MessageBox::warning
-            (SMESHGUI::desktop(),
-             QObject::tr("SMESH_WRN_WARNING"),
-             QObject::tr("SMESH_EXPORT_STL2").arg(aMeshName),
-             QObject::tr("SMESH_BUT_YES"),
-             QObject::tr("SMESH_BUT_NO"), 0, 1);
-          if (aRet != 0)
-            return;
-        }
+//         if (aMesh->NbTriangles() < 1) {
+//           SUIT_MessageBox::warning
+//             (SMESHGUI::desktop(),
+//              QObject::tr("SMESH_WRN_WARNING"),
+//              QObject::tr("SMESH_EXPORT_STL1").arg(aMeshName));
+//           return;
+//         }
+//         if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
+//           int aRet = SUIT_MessageBox::warning
+//             (SMESHGUI::desktop(),
+//              QObject::tr("SMESH_WRN_WARNING"),
+//              QObject::tr("SMESH_EXPORT_STL2").arg(aMeshName),
+//              QObject::tr("SMESH_BUT_YES"),
+//              QObject::tr("SMESH_BUT_NO"), 0, 1);
+//           if (aRet != 0)
+//             return;
+//         }
 
         aFilterMapSTL.insert( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)", 1 ); // 1 - ASCII mode
         aFilterMapSTL.insert( QObject::tr( "STL_BIN_FILES_FILTER" )   + " (*.stl)", 0 ); // 0 - Binary mode
     if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
       anInitialPath = QDir::currentPath();
 
-    if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
+    if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 141) {
       if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
       aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + aMeshName,
                                             aFilter, aTitle, false);
     }
-    else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
+    else if(theCommandID == 141) { // Export to STL
       QStringList filters;
       QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
       for ( ; it != aFilterMapSTL.end(); ++it )
         case 123:
           aMesh->ExportUNV( aFilename.toLatin1().data() );
           break;
-        case 140:
         case 141:
           aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
           break;
 
     SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 
-    ViewManagerList aViewMenegers = anApp->viewManagers();
-    ViewManagerList::const_iterator it = aViewMenegers.begin();
-    for( ; it != aViewMenegers.end(); it++) {
-      
-      SUIT_ViewManager* vm = *it;
-      int nbSf = vm ? vm->getViewsCount() : 0;
-
       SALOME_ListIteratorOfListIO It(selected);
       
       aStudyBuilder->NewCommand();  // There is a transaction
             std::string anEntry = SO->GetID();
             
             /** Erase graphical object **/
-            if(SO->FindAttribute(anAttr, "AttributeIOR") && vm ){
-              QVector<SUIT_ViewWindow*> aViews = vm->getViews();
-              for(int i = 0; i < nbSf; i++){
-                SUIT_ViewWindow *sf = aViews[i];
-                if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
-                  SMESH::RemoveActor(sf,anActor);
+          if(SO->FindAttribute(anAttr, "AttributeIOR")){
+            ViewManagerList aViewMenegers = anApp->viewManagers();
+            ViewManagerList::const_iterator it = aViewMenegers.begin();
+            for( ; it != aViewMenegers.end(); it++) {         
+              SUIT_ViewManager* vm = *it;
+              int nbSf = vm ? vm->getViewsCount() : 0;
+              if(vm) {
+                QVector<SUIT_ViewWindow*> aViews = vm->getViews();
+                for(int i = 0; i < nbSf; i++){
+                  SUIT_ViewWindow *sf = aViews[i];
+                  if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
+                    SMESH::RemoveActor(sf,anActor);
+                  }
                 }
               }
             }
-            
+          }
             /** Remove an object from data structures **/
             SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
             SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO ));
           } /* listSO back loop */
         } /* IObject->hasEntry() */
       } /* more/next */
-    } /* aViewMenegers list loop */
     
     aStudyBuilder->CommitCommand();
 
@@ -1571,8 +1590,8 @@ LightApp_Module( "SMESH" )
 SMESHGUI::~SMESHGUI()
 {
 #ifdef WITHGENERICOBJ
-  SMESH::GetFilterManager()->Destroy();
-  SMESH::GetMeasurements()->Destroy();
+  SMESH::GetFilterManager()->UnRegister();
+  SMESH::GetMeasurements()->UnRegister();
 #endif
   SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
   SMESH::GetMeasurements() = SMESH::Measurements::_nil();
@@ -1862,6 +1881,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 113:                                     // IMPORT
   case 112:
   case 111:
+  case 140:
     {
       if(checkLock(aStudy)) break;
       ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
@@ -1893,7 +1913,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 124:
   case 125:
   case 126:
-  case 140:
   case 141:
     {
       ::ExportMeshToFile(theCommandID);
@@ -2361,24 +2380,33 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
                 SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
                 // create group for each type o elements
                 QString aName = IObject->getName();
+                QStringList anEntryList;
                 if (aNodes->length() > 0) {
                   SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
                   aGroup->Add(aNodes.inout());
+                  if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+                    anEntryList.append( aSObject->GetID().c_str() );
                 }
                 if (aEdges->length() > 0) {
                   SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
                   aGroup->Add(aEdges.inout());
+                  if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+                    anEntryList.append( aSObject->GetID().c_str() );
                 }
                 if (aFaces->length() > 0) {
                   SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
                   aGroup->Add(aFaces.inout());
+                  if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+                    anEntryList.append( aSObject->GetID().c_str() );
                 }
                 if (aVolumes->length() > 0) {
                   SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
                   aGroup->Add(aVolumes.inout());
+                  if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+                    anEntryList.append( aSObject->GetID().c_str() );
                 }
                 updateObjBrowser();
-
+                anApp->browseObjects( anEntryList );
               }
               catch(const SALOME::SALOME_Exception & S_ex){
                 SalomeApp_Tools::QtCatchCorbaException(S_ex);
@@ -2638,71 +2666,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
       break;
     }
-
-  case 1101:                                    // RENAME
-    {
-      if ( checkLock( aStudy ) )
-        break;
-
-      LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
-      SALOME_ListIO selected;
-      if( aSel )
-        aSel->selectedObjects( selected );
-
-      bool isAny = false; // is there any appropriate object selected
-
-      SALOME_ListIteratorOfListIO It( selected );
-      for ( ; It.More(); It.Next() )
-      {
-        Handle(SALOME_InteractiveObject) IObject = It.Value();
-        _PTR(SObject) obj = aStudy->FindObjectID( IObject->getEntry() );
-        _PTR(GenericAttribute) anAttr;
-        _PTR(AttributeName) aName;
-        if ( obj )
-        {
-          if ( obj->FindAttribute(anAttr, "AttributeName") )
-          {
-            aName = anAttr;
-            QString newName = QString(aName->Value().c_str());
-
-            // check type to prevent renaming of inappropriate objects
-            int aType = SMESHGUI_Selection::type(IObject->getEntry(), aStudy);
-            if (aType == MESH || aType == GROUP ||
-                aType == SUBMESH || aType == SUBMESH_COMPOUND ||
-                aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
-                aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
-                aType == HYPOTHESIS || aType == ALGORITHM)
-            {
-              isAny = true;
-              newName = LightApp_NameDlg::getName(desktop(), newName);
-              if ( !newName.isEmpty() )
-              {
-                SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data());
-
-                // update name of group object and its actor
-                SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
-                if( !aGroupObject->_is_nil() )
-                {
-                  aGroupObject->SetName( newName.toLatin1().data() );
-                  if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) )
-                    anActor->setName( newName.toLatin1().data() );
-                }
-
-                updateObjBrowser();
-              }
-            }
-          }
-        }
-      } // for
-
-      if (!isAny) {
-        SUIT_MessageBox::warning(desktop(),
-                                 QObject::tr("SMESH_WRN_WARNING"),
-                                 QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION"));
-      }
-      break;
-    }
-
   case 1102:                                    // REMOVE HYPOTHESIS / ALGORITHMS
     {
       if(checkLock(aStudy)) break;
@@ -2858,7 +2821,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IOS);
       if ( aMesh->_is_nil()) continue;
       try {
-        SMESH::UpdateView(SMESH::eErase, IOS->getEntry());
+        SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true);
         aMesh->Clear();
         _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
         SMESH::ModifiedMesh( aMeshSObj, false, true);
@@ -2868,7 +2831,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
         {
           _PTR(SObject) so = anIter->Value();
-          SMESH::UpdateView(SMESH::eErase, so->GetID().c_str());
+          SMESH::RemoveVisualObjectWithActors(so->GetID().c_str(), true);
         }
       }
       catch (const SALOME::SALOME_Exception& S_ex){
@@ -3415,7 +3378,6 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  232, "ARC_REPRESENTATION", "", 0, true );
 
   createSMESHAction( 1100, "EDIT_HYPO" );
-  createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 );
   createSMESHAction( 1102, "UNASSIGN" );
   createSMESHAction( 9010, "NUM_NODES", "", 0, true );
   createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
@@ -3469,11 +3431,12 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( 111, importId, -1 );
   createMenu( 112, importId, -1 );
   createMenu( 113, importId, -1 );
+  createMenu( 140, importId, -1 );
 
   createMenu( 121, exportId, -1 );
   createMenu( 122, exportId, -1 );
   createMenu( 123, exportId, -1 );
-  createMenu( 140, exportId, -1 ); // export to stl STL
+  createMenu( 141, exportId, -1 ); // export to stl STL
 
   createMenu( separator(), fileId, 10 );
 
@@ -3565,10 +3528,10 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( 4061, transfId, -1 );
   createMenu( 4062, transfId, -1 );
   createMenu( 4063, transfId, -1 );
+  createMenu( 4068, transfId, -1 );
   createMenu( 4064, transfId, -1 );
   createMenu( 4065, transfId, -1 );
   createMenu( 4066, transfId, -1 );
-  createMenu( 4068, transfId, -1 );
   createMenu( 4069, transfId, -1 );
 
   createMenu( 4067,modifyId, -1 );
@@ -3676,10 +3639,10 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( 4061, addRemTb );
   createTool( 4062, addRemTb );
   createTool( 4063, addRemTb );
+  createTool( 4068, addRemTb );
   createTool( 4064, addRemTb );
   createTool( 4065, addRemTb );
   createTool( 4066, addRemTb );
-  createTool( 4068, addRemTb );
   createTool( 4069, addRemTb );
   createTool( separator(), addRemTb );
 
@@ -3754,7 +3717,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 900, OB, mesh_group );                  // ADV_INFO
   //createPopupItem( 902, OB, mesh );                        // STD_INFO
   createPopupItem( 903, OB, mesh_group );                  // WHAT_IS
-  createPopupItem( 904, OB, mesh_group );                  // FIND_ELEM
+  createPopupItem( 904, OB, mesh );                        // FIND_ELEM
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 801, OB, mesh );                        // CREATE_GROUP
   createPopupItem( 806, OB, mesh );                        // CREATE_GEO_GROUP
@@ -3762,12 +3725,11 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 1100, OB, hypo);                        // EDIT HYPOTHESIS
   createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
-  createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 4043, OB, mesh );                       // CLEAR_MESH
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( 417, OB, mesh/*, "&& " + hasElems*/);       // convert to quadratic
-  createPopupItem( 418, OB, mesh/*, "&& " + hasVolumes*/);     // create 2D mesh on 3D
+  createPopupItem( 417, OB, mesh + " " + subMesh );         // convert to quadratic
+  createPopupItem( 418, OB, mesh/*, "&& " + hasVolumes*/);  // create 2D mesh on 3D
   popupMgr()->insert( separator(), -1, 0 );
 
   QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
@@ -3790,7 +3752,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 900, View, mesh_group ); // ADV_INFO
   //createPopupItem( 902, View, mesh );       // STD_INFO
   createPopupItem( 903, View, mesh_group ); // WHAT_IS
-  createPopupItem( 904, View, mesh_group ); // FIND_ELEM
+  createPopupItem( 904, View, mesh );       // FIND_ELEM
   popupMgr()->insert( separator(), -1, 0 );
 
   createPopupItem( 1136, OB + " " + View, mesh, "&& (not isAutoColor)" ); // AUTO_COLOR
@@ -4130,7 +4092,6 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
   action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
 
   action(  33)->setEnabled(true); // Delete: Key_Delete
-  action(1101)->setEnabled(true); // Rename: Key_F2
 
   //  0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH
   GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil());
@@ -4166,7 +4127,6 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study )
   action(113)->setShortcut(QKeySequence()); // Import MED
 
   action(  33)->setEnabled(false); // Delete: Key_Delete
-  action(1101)->setEnabled(false); // Rename: Key_F2
 
   return SalomeApp_Module::deactivateModule( study );
 }
@@ -4702,7 +4662,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
 //================================================================================
 void SMESHGUI::update( const int flags )
 {
-  if ( flags & UF_Viewer | flags & UF_Forced )
+  if ( (flags & UF_Viewer) | (flags & UF_Forced) )
     SMESH::UpdateView();
   else
     SalomeApp_Module::update( flags );
@@ -5733,3 +5693,84 @@ void SMESHGUI::connectView( const SUIT_ViewWindow* pview ) {
   }
 }
  
+/*!
+  \brief Return \c true if object can be renamed
+*/
+bool SMESHGUI::renameAllowed( const QString& entry) const {
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
+  if( !anApp )
+    return false;
+
+  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+  if( !aStudy )
+    return false;
+
+  bool appRes = SalomeApp_Module::renameAllowed(entry);
+  if( !appRes )
+    return false;
+  
+  // check type to prevent renaming of inappropriate objects
+  int aType = SMESHGUI_Selection::type(qPrintable(entry), aStudy);
+  if (aType == MESH || aType == GROUP ||
+      aType == SUBMESH || aType == SUBMESH_COMPOUND ||
+      aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
+      aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
+      aType == HYPOTHESIS || aType == ALGORITHM)
+    return true;
+
+  return false;
+}
+
+/*!
+  Rename object by entry.
+  \param entry entry of the object
+  \param name new name of the object
+  \brief Return \c true if rename operation finished successfully, \c false otherwise.
+*/
+bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
+  
+  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
+  if( !anApp )
+    return false;
+  
+  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+  if( !aStudy )
+    return false;
+
+  bool appRes = SalomeApp_Module::renameObject(entry,name);
+  if( !appRes )
+    return false;
+  
+  _PTR(SObject) obj = aStudy->FindObjectID( qPrintable(entry) );
+  _PTR(GenericAttribute) anAttr;
+  _PTR(AttributeName) aName;
+  if ( obj ) {
+    if ( obj->FindAttribute(anAttr, "AttributeName") ) {
+      aName = anAttr;
+      // check type to prevent renaming of inappropriate objects
+      int aType = SMESHGUI_Selection::type( qPrintable(entry), aStudy );
+      if (aType == MESH || aType == GROUP ||
+         aType == SUBMESH || aType == SUBMESH_COMPOUND ||
+         aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
+         aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
+         aType == HYPOTHESIS || aType == ALGORITHM) {
+       if ( !name.isEmpty() ) {
+         SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), qPrintable(name) );
+         
+         // update name of group object and its actor
+         Handle(SALOME_InteractiveObject) IObject = 
+           new SALOME_InteractiveObject ( qPrintable(entry), "SMESH", qPrintable(name) );
+         
+         SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
+         if( !aGroupObject->_is_nil() ) {
+           aGroupObject->SetName( qPrintable(name) );
+           if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( qPrintable(entry) ) )
+             anActor->setName( qPrintable(name) );
+         }
+         return true;
+       }
+      }  
+    }
+  }
+  return false;
+}