0020746: EDF 1274 SMESH : MergeAllNodesButNodesFromGroup feature

This commit is contained in:
vsr 2010-09-27 06:17:50 +00:00
parent 92ccacc7e0
commit 79d1c82a95
6 changed files with 90 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -2,8 +2,9 @@
\page merging_nodes_page Merging nodes \page merging_nodes_page Merging nodes
\n This functionality allows user to detect groups of coincident nodes This functionality allows user to detect groups of coincident nodes
with desirable tolerance, edit these groups and merge. 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" \image html mergenodes_ico.png "Merge nodes button"
@ -12,7 +13,7 @@ with desirable tolerance, edit these groups and merge.
<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 sub-menu select the <b>Merge nodes</b> item. The following dialog box
shall appear:</li> shall appear:</li>
<br>
\image html mergenodes_auto.png \image html mergenodes_auto.png
<br> <br>
<ul> <ul>
@ -21,13 +22,16 @@ shall appear:</li>
processed. processed.
<li>\b Tolerance is a maximum distance between nodes sufficient for <li>\b Tolerance is a maximum distance between nodes sufficient for
merging.</li> merging.</li>
<li><b>Exclude Groups</b> group box allows to ignore the nodes which
belong to the specified mesh groups.
</ul> </ul>
<li><b>Automatic mode:</b> <li><b>Automatic mode:</b>
<br> <br>
<ul> <ul>
<li>In the \b Automatic Mode all Nodes within the indicated tolerance <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> </ul>
</li><br> </li><br>
<li>If the \b Manual Mode is selected, additional controls are available: <li>If the \b Manual Mode is selected, additional controls are available:
@ -44,8 +48,9 @@ viewer with pressed "Shift" key.</li>
<li><b>Select all</b> checkbox selects all groups.</li> <li><b>Select all</b> checkbox selects all groups.</li>
</ul> </ul>
<br>
\image html mergenodes.png \image html mergenodes.png
<br>
</li> </li>
<li><b>Edit selected group</b> list allows editing the selected <li><b>Edit selected group</b> list allows editing the selected
group: group:

View File

@ -391,29 +391,43 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
this); this);
QVBoxLayout* aCoincidentLayout = new QVBoxLayout(GroupCoincident); QVBoxLayout* aCoincidentLayout = new QVBoxLayout(GroupCoincident);
aCoincidentLayout->setSpacing(SPACING);
GroupCoincident->setLayout(aCoincidentLayout); aCoincidentLayout->setMargin(MARGIN);
QHBoxLayout* aSpinBoxLayout = new QHBoxLayout( GroupCoincident );
if (myAction == 0) { // case merge nodes if (myAction == 0) { // case merge nodes
TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupCoincident); QWidget* foo = new QWidget(GroupCoincident);
SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident); TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), foo);
SpinBoxTolerance = new SMESHGUI_SpinBox(foo);
SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
aSpinBoxLayout->addWidget(TextLabelTolerance); GroupExclude = new QGroupBox(tr("EXCLUDE_GROUPS"), foo);
aSpinBoxLayout->addWidget(SpinBoxTolerance); GroupExclude->setCheckable( true );
aCoincidentLayout->addLayout(aSpinBoxLayout); 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 { else {
TextLabelTolerance = 0; TextLabelTolerance = 0;
SpinBoxTolerance = 0; SpinBoxTolerance = 0;
GroupExclude = 0;
ListExclude = 0;
} }
GroupCoincidentWidget = new QWidget(GroupCoincident); GroupCoincidentWidget = new QWidget(GroupCoincident);
QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincidentWidget); QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincidentWidget);
GroupCoincidentLayout->setSpacing(SPACING); GroupCoincidentLayout->setSpacing(SPACING);
GroupCoincidentLayout->setMargin(MARGIN); GroupCoincidentLayout->setMargin(0);
ListCoincident = new QListWidget(GroupCoincidentWidget); ListCoincident = new QListWidget(GroupCoincidentWidget);
ListCoincident->setSelectionMode(QListWidget::ExtendedSelection); ListCoincident->setSelectionMode(QListWidget::ExtendedSelection);
@ -424,11 +438,6 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget); SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget);
if (myAction == 0)
GroupCoincidentWidget->hide();
else
GroupCoincident->hide();
GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2); GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2);
GroupCoincidentLayout->addWidget(DetectButton, 0, 2); GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
GroupCoincidentLayout->addWidget(AddGroupButton, 2, 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(RemoveElemButton, 0, 2);
GroupEditLayout->addWidget(SetFirstButton, 1, 1, 1, 2); GroupEditLayout->addWidget(SetFirstButton, 1, 1, 1, 2);
GroupEdit->hide();
/***************************************************************/ /***************************************************************/
GroupButtons = new QGroupBox(this); GroupButtons = new QGroupBox(this);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
@ -499,6 +506,11 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
DlgLayout->addWidget(GroupEdit); DlgLayout->addWidget(GroupEdit);
DlgLayout->addWidget(GroupButtons); DlgLayout->addWidget(GroupButtons);
GroupCoincidentWidget->setVisible( myAction != 0 );
GroupCoincident->setVisible( myAction == 0 );
//if GroupExclude->setVisible( myAction == 0 );
GroupEdit->hide();
this->resize(10,10); this->resize(10,10);
Init(); // Initialisations Init(); // Initialisations
@ -783,19 +795,27 @@ void SMESHGUI_MergeDlg::onDetect()
ListEdit->clear(); ListEdit->clear();
SMESH::array_of_long_array_var aGroupsArray; 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) { switch (myAction) {
case 0 : case 0 :
if(!mySubMeshOrGroup->_is_nil()) for ( int i = 0; GroupExclude->isChecked() && i < ListExclude->count(); i++ ) {
aMeshEditor->FindCoincidentNodesOnPart(mySubMeshOrGroup, SpinBoxTolerance->GetValue(), aGroupsArray); if ( ListExclude->item( i )->checkState() == Qt::Checked ) {
else aExcludeGroups->length( aExcludeGroups->length()+1 );
aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aGroupsArray); aExcludeGroups[ aExcludeGroups->length()-1 ] = SMESH::SMESH_IDSource::_duplicate( myGroups[i] );
}
}
aMeshEditor->FindCoincidentNodesOnPartBut(src.in(),
SpinBoxTolerance->GetValue(),
aGroupsArray.out(),
aExcludeGroups.in());
break; break;
case 1 : case 1 :
if(!mySubMeshOrGroup->_is_nil()) aMeshEditor->FindEqualElements(src.in(), aGroupsArray.out());
aMeshEditor->FindEqualElements(mySubMeshOrGroup, aGroupsArray);
else
aMeshEditor->FindEqualElements(myMesh, aGroupsArray);
break; break;
} }
@ -1082,6 +1102,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
ListCoincident->clear(); ListCoincident->clear();
ListEdit->clear(); ListEdit->clear();
myActor = 0; myActor = 0;
QString aCurrentEntry = myEntry;
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
if (nbSel != 1) { if (nbSel != 1) {
@ -1097,6 +1118,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
mySelectionMgr->selectedObjects(aList); mySelectionMgr->selectedObjects(aList);
Handle(SALOME_InteractiveObject) IO = aList.First(); Handle(SALOME_InteractiveObject) IO = aList.First();
myEntry = IO->getEntry();
myMesh = SMESH::GetMeshByIO(IO); myMesh = SMESH::GetMeshByIO(IO);
if (myMesh->_is_nil()) if (myMesh->_is_nil())
@ -1127,6 +1149,26 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
aViewWindow->SetSelectionMode(CellSelection); 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(); updateControls();
} }
} }

View File

@ -89,6 +89,8 @@ private:
// add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list
private: private:
typedef QList<SMESH::SMESH_GroupBase_var> GrpList;
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
@ -137,11 +139,17 @@ private:
QPushButton* RemoveElemButton; QPushButton* RemoveElemButton;
QPushButton* SetFirstButton; QPushButton* SetFirstButton;
QGroupBox* GroupExclude;
QListWidget* ListExclude;
QGroupBox* TypeBox; QGroupBox* TypeBox;
QButtonGroup* GroupType; QButtonGroup* GroupType;
QString myHelpFileName; QString myHelpFileName;
QString myEntry;
GrpList myGroups;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel(); void ClickOnCancel();

View File

@ -3779,6 +3779,10 @@ Please select a groups and try again</translation>
<source>SELECT_ALL</source> <source>SELECT_ALL</source>
<translation>Select all</translation> <translation>Select all</translation>
</message> </message>
<message>
<source>EXCLUDE_GROUPS</source>
<translation>Exclude Groups</translation>
</message>
</context> </context>
<context> <context>
<name>SMESHGUI_ExtrusionAlongPathDlg</name> <name>SMESHGUI_ExtrusionAlongPathDlg</name>