From: vsr Date: Mon, 27 Sep 2010 06:17:50 +0000 (+0000) Subject: 0020746: EDF 1274 SMESH : MergeAllNodesButNodesFromGroup feature X-Git-Tag: V5_1_5a1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=79d1c82a951df86f65360636906b1f7e3dfb3528 0020746: EDF 1274 SMESH : MergeAllNodesButNodesFromGroup feature --- diff --git a/doc/salome/gui/SMESH/images/mergenodes.png b/doc/salome/gui/SMESH/images/mergenodes.png index 024bc22e8..54cb3d17a 100755 Binary files a/doc/salome/gui/SMESH/images/mergenodes.png and b/doc/salome/gui/SMESH/images/mergenodes.png differ diff --git a/doc/salome/gui/SMESH/images/mergenodes_auto.png b/doc/salome/gui/SMESH/images/mergenodes_auto.png index b2920867c..71511d22e 100644 Binary files a/doc/salome/gui/SMESH/images/mergenodes_auto.png and b/doc/salome/gui/SMESH/images/mergenodes_auto.png differ diff --git a/doc/salome/gui/SMESH/input/merging_nodes.doc b/doc/salome/gui/SMESH/input/merging_nodes.doc index eb17e0a14..3b1bbeaaf 100644 --- a/doc/salome/gui/SMESH/input/merging_nodes.doc +++ b/doc/salome/gui/SMESH/input/merging_nodes.doc @@ -2,17 +2,18 @@ \page merging_nodes_page Merging nodes -\n This functionality allows user to detect groups of coincident nodes -with desirable tolerance, edit these groups and merge. +This functionality allows user to detect groups of coincident nodes +with specified tolerance; each group of the coincident nodes can be +then converted to the single node. \image html mergenodes_ico.png "Merge nodes button" To merge nodes of your mesh:
    -
  1. From the \b Modification choose \b Transformation and from its +
  2. From the \b Modification choose \b Transformation and from its sub-menu select the Merge nodes item. The following dialog box shall appear:
  3. - +
    \image html mergenodes_auto.png
  4. Automatic mode:
    • In the \b Automatic Mode all Nodes within the indicated tolerance -will be merged.
    • +will be merged. The nodes which belong to the groups specified in the +Exclude Groups will be not taken into account.

  5. If the \b Manual Mode is selected, additional controls are available: @@ -44,8 +48,9 @@ viewer with pressed "Shift" key.
  6. Select all checkbox selects all groups.
  7. +
    \image html mergenodes.png - +
  8. Edit selected group list allows editing the selected group: diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx index ff37f9f56..26922e93d 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx @@ -391,29 +391,43 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) this); QVBoxLayout* aCoincidentLayout = new QVBoxLayout(GroupCoincident); + aCoincidentLayout->setSpacing(SPACING); + aCoincidentLayout->setMargin(MARGIN); - GroupCoincident->setLayout(aCoincidentLayout); - - QHBoxLayout* aSpinBoxLayout = new QHBoxLayout( GroupCoincident ); - if (myAction == 0) { // case merge nodes - TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupCoincident); - SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident); + QWidget* foo = new QWidget(GroupCoincident); + TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), foo); + SpinBoxTolerance = new SMESHGUI_SpinBox(foo); SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - aSpinBoxLayout->addWidget(TextLabelTolerance); - aSpinBoxLayout->addWidget(SpinBoxTolerance); - aCoincidentLayout->addLayout(aSpinBoxLayout); + GroupExclude = new QGroupBox(tr("EXCLUDE_GROUPS"), foo); + GroupExclude->setCheckable( true ); + GroupExclude->setChecked( false ); + ListExclude = new QListWidget( GroupExclude ); + QVBoxLayout* GroupExcludeLayout = new QVBoxLayout(GroupExclude); + GroupExcludeLayout->setSpacing(SPACING); + GroupExcludeLayout->setMargin(MARGIN); + GroupExcludeLayout->addWidget(ListExclude); + + QGridLayout* fooLayout = new QGridLayout( foo ); + fooLayout->setSpacing(SPACING); + fooLayout->setMargin(0); + fooLayout->addWidget(TextLabelTolerance, 0, 0 ); + fooLayout->addWidget(SpinBoxTolerance, 0, 1 ); + fooLayout->addWidget(GroupExclude, 1, 0, 1, 2 ); + aCoincidentLayout->addWidget(foo); } else { TextLabelTolerance = 0; SpinBoxTolerance = 0; + GroupExclude = 0; + ListExclude = 0; } GroupCoincidentWidget = new QWidget(GroupCoincident); QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincidentWidget); GroupCoincidentLayout->setSpacing(SPACING); - GroupCoincidentLayout->setMargin(MARGIN); + GroupCoincidentLayout->setMargin(0); ListCoincident = new QListWidget(GroupCoincidentWidget); ListCoincident->setSelectionMode(QListWidget::ExtendedSelection); @@ -424,11 +438,6 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget); - if (myAction == 0) - GroupCoincidentWidget->hide(); - else - GroupCoincident->hide(); - GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2); GroupCoincidentLayout->addWidget(DetectButton, 0, 2); GroupCoincidentLayout->addWidget(AddGroupButton, 2, 2); @@ -465,8 +474,6 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) GroupEditLayout->addWidget(RemoveElemButton, 0, 2); GroupEditLayout->addWidget(SetFirstButton, 1, 1, 1, 2); - GroupEdit->hide(); - /***************************************************************/ GroupButtons = new QGroupBox(this); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); @@ -499,6 +506,11 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) DlgLayout->addWidget(GroupEdit); DlgLayout->addWidget(GroupButtons); + GroupCoincidentWidget->setVisible( myAction != 0 ); + GroupCoincident->setVisible( myAction == 0 ); + //if GroupExclude->setVisible( myAction == 0 ); + GroupEdit->hide(); + this->resize(10,10); Init(); // Initialisations @@ -783,19 +795,27 @@ void SMESHGUI_MergeDlg::onDetect() ListEdit->clear(); SMESH::array_of_long_array_var aGroupsArray; + SMESH::ListOfIDSources_var aExcludeGroups = new SMESH::ListOfIDSources; + + SMESH::SMESH_IDSource_var src; + if ( mySubMeshOrGroup->_is_nil() ) src = SMESH::SMESH_IDSource::_duplicate( myMesh ); + else src = SMESH::SMESH_IDSource::_duplicate( mySubMeshOrGroup ); switch (myAction) { case 0 : - if(!mySubMeshOrGroup->_is_nil()) - aMeshEditor->FindCoincidentNodesOnPart(mySubMeshOrGroup, SpinBoxTolerance->GetValue(), aGroupsArray); - else - aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aGroupsArray); + for ( int i = 0; GroupExclude->isChecked() && i < ListExclude->count(); i++ ) { + if ( ListExclude->item( i )->checkState() == Qt::Checked ) { + aExcludeGroups->length( aExcludeGroups->length()+1 ); + aExcludeGroups[ aExcludeGroups->length()-1 ] = SMESH::SMESH_IDSource::_duplicate( myGroups[i] ); + } + } + aMeshEditor->FindCoincidentNodesOnPartBut(src.in(), + SpinBoxTolerance->GetValue(), + aGroupsArray.out(), + aExcludeGroups.in()); break; case 1 : - if(!mySubMeshOrGroup->_is_nil()) - aMeshEditor->FindEqualElements(mySubMeshOrGroup, aGroupsArray); - else - aMeshEditor->FindEqualElements(myMesh, aGroupsArray); + aMeshEditor->FindEqualElements(src.in(), aGroupsArray.out()); break; } @@ -1082,6 +1102,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument() ListCoincident->clear(); ListEdit->clear(); myActor = 0; + QString aCurrentEntry = myEntry; int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); if (nbSel != 1) { @@ -1097,6 +1118,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument() mySelectionMgr->selectedObjects(aList); Handle(SALOME_InteractiveObject) IO = aList.First(); + myEntry = IO->getEntry(); myMesh = SMESH::GetMeshByIO(IO); if (myMesh->_is_nil()) @@ -1127,6 +1149,26 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument() aViewWindow->SetSelectionMode(CellSelection); } + // process groups + if ( myAction == 0 && !myMesh->_is_nil() && myEntry != aCurrentEntry ) { + myGroups.clear(); + ListExclude->clear(); + SMESH::ListOfGroups_var aListOfGroups = myMesh->GetGroups(); + for( int i = 0, n = aListOfGroups->length(); i < n; i++ ) { + SMESH::SMESH_GroupBase_var aGroup = aListOfGroups[i]; + if ( !aGroup->_is_nil() ) { // && aGroup->GetType() == SMESH::NODE + QString aGroupName( aGroup->GetName() ); + if ( !aGroupName.isEmpty() ) { + myGroups.append(SMESH::SMESH_GroupBase::_duplicate(aGroup)); + QListWidgetItem* item = new QListWidgetItem( aGroupName ); + item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ); + item->setCheckState( Qt::Unchecked ); + ListExclude->addItem( item ); + } + } + } + } + updateControls(); } } diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.h b/src/SMESHGUI/SMESHGUI_MergeDlg.h index 30f32374a..73dce16c0 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.h +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.h @@ -89,6 +89,8 @@ private: // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list private: + typedef QList GrpList; + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ SVTK_Selector* mySelector; @@ -137,11 +139,17 @@ private: QPushButton* RemoveElemButton; QPushButton* SetFirstButton; + QGroupBox* GroupExclude; + QListWidget* ListExclude; + QGroupBox* TypeBox; QButtonGroup* GroupType; QString myHelpFileName; + QString myEntry; + GrpList myGroups; + private slots: void ClickOnOk(); void ClickOnCancel(); diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 56554a396..b883c89d7 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -3779,6 +3779,10 @@ Please select a groups and try again SELECT_ALL Select all + + EXCLUDE_GROUPS + Exclude Groups + SMESHGUI_ExtrusionAlongPathDlg