+ if( anElemId != -1 && GroupGroups->isChecked() ) {
+ SMESH::SMESH_Group_var aGroup;
+ QString aGroupName = ComboBox_GroupName->currentText();
+ SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
+ for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) {
+ SMESH::SMESH_GroupBase_var aGroupBase = aListOfGroups[i];
+ if( !aGroupBase->_is_nil() ) {
+ SMESH::SMESH_Group_var aRefGroup = SMESH::SMESH_Group::_narrow( aGroupBase );
+ if( !aRefGroup->_is_nil() ) {
+ QString aRefGroupName( aRefGroup->GetName() );
+ if( aRefGroupName == aGroupName ) {
+ aGroup = aRefGroup; // // add node to existing group
+ break;
+ }
+ }
+ }
+ }
+ if( aGroup->_is_nil() ) // create new group
+ aGroup = SMESH::AddGroup( myMesh, (SMESH::ElementType)myElementType, aGroupName );
+
+ if( !aGroup->_is_nil() ) {
+ SMESH::long_array_var anIdList = new SMESH::long_array;
+ anIdList->length( 1 );
+ anIdList[0] = anElemId;
+ aGroup->Add( anIdList.inout() );
+ }
+ }
+