\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"
<em>To merge nodes of your mesh:</em>
<ol>
-<li>From the \b Modification choose \b Transformation and from its
+<li>From the \b Modification choose \b Transformation and from its
sub-menu select the <b>Merge nodes</b> item. The following dialog box
shall appear:</li>
-
+<br>
\image html mergenodes_auto.png
<br>
<ul>
processed.
<li>\b Tolerance is a maximum distance between nodes sufficient for
merging.</li>
+<li><b>Exclude Groups</b> group box allows to ignore the nodes which
+belong to the specified mesh groups.
</ul>
<li><b>Automatic mode:</b>
<br>
<ul>
<li>In the \b Automatic Mode all Nodes within the indicated tolerance
-will be merged.</li>
+will be merged. The nodes which belong to the groups specified in the
+<b>Exclude Groups</b> will be not taken into account.</li>
</ul>
</li><br>
<li>If the \b Manual Mode is selected, additional controls are available:
<li><b>Select all</b> checkbox selects all groups.</li>
</ul>
+<br>
\image html mergenodes.png
-
+<br>
</li>
<li><b>Edit selected group</b> list allows editing the selected
group:
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);
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);
GroupEditLayout->addWidget(RemoveElemButton, 0, 2);
GroupEditLayout->addWidget(SetFirstButton, 1, 1, 1, 2);
- GroupEdit->hide();
-
/***************************************************************/
GroupButtons = new QGroupBox(this);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
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
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;
}
ListCoincident->clear();
ListEdit->clear();
myActor = 0;
+ QString aCurrentEntry = myEntry;
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
if (nbSel != 1) {
mySelectionMgr->selectedObjects(aList);
Handle(SALOME_InteractiveObject) IO = aList.First();
+ myEntry = IO->getEntry();
myMesh = SMESH::GetMeshByIO(IO);
if (myMesh->_is_nil())
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();
}
}