- {
- SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
-
- QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- anIdsOfFaces->length(aListId.count());
- for ( int i = 0; i < aListId.count(); i++ )
- anIdsOfFaces[i] = aListId[i].toInt();
-
- try{
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
- }catch(SALOME::SALOME_Exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
- }
-
+ {
+ SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
+
+ QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ anIdsOfFaces->length(aListId.count());
+ for ( int i = 0; i < aListId.count(); i++ )
+ anIdsOfFaces[i] = aListId[i].toInt();
+
+ try{
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ anElemId = aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
+ }catch(SALOME::SALOME_Exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
+
+ if ( anElemId != -1 && addToGroup && !aGroupName.isEmpty() ) {
+ SMESH::SMESH_Group_var aGroupUsed;
+ if ( aGroup->_is_nil() ) {
+ // create new group
+ aGroupUsed = SMESH::AddGroup( myMesh, SMESH::VOLUME, aGroupName );
+ if ( !aGroupUsed->_is_nil() ) {
+ myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroupUsed));
+ ComboBox_GroupName->addItem( aGroupName );
+ }
+ }
+ else {
+ SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
+ if ( !aGeomGroup->_is_nil() ) {
+ aGroupUsed = myMesh->ConvertToStandalone( aGeomGroup );
+ if ( !aGroupUsed->_is_nil() && idx > 0 ) {
+ myGroups[idx-1] = SMESH::SMESH_GroupBase::_duplicate(aGroupUsed);
+ SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser();
+ }
+ }
+ else
+ aGroupUsed = SMESH::SMESH_Group::_narrow( aGroup );
+ }
+
+ if ( !aGroupUsed->_is_nil() ) {
+ SMESH::long_array_var anIdList = new SMESH::long_array;
+ anIdList->length( 1 );
+ anIdList[0] = anElemId;
+ aGroupUsed->Add( anIdList.inout() );
+ }
+ }
+