mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 10:37:28 +05:00
0022108: EDF 2547 SMESH: Duplicate elements only
This commit is contained in:
parent
85ee212909
commit
4effbfc0dc
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "SMESHGUI.h"
|
#include "SMESHGUI.h"
|
||||||
#include "SMESHGUI_Utils.h"
|
#include "SMESHGUI_Utils.h"
|
||||||
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_VTKUtils.h"
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
|
|
||||||
#include <SMESH_TypeFilter.hxx>
|
#include <SMESH_TypeFilter.hxx>
|
||||||
@ -63,6 +64,7 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
|
#include <SALOMEDSClient_SObject.hxx>
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -107,6 +109,7 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
|
|||||||
SUIT_ResourceMgr* aResMgr = SMESH::GetResourceMgr( mySMESHGUI );
|
SUIT_ResourceMgr* aResMgr = SMESH::GetResourceMgr( mySMESHGUI );
|
||||||
QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES")));
|
QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES")));
|
||||||
QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM")));
|
QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM")));
|
||||||
|
QPixmap iconElemOnly (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_ELEM_ONLY")));
|
||||||
QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT")));
|
QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||||
|
|
||||||
// Main layout
|
// Main layout
|
||||||
@ -125,11 +128,15 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
|
|||||||
aRadioButton1->setIcon(iconWithoutElem);
|
aRadioButton1->setIcon(iconWithoutElem);
|
||||||
QRadioButton* aRadioButton2 = new QRadioButton(aConstructorsBox);
|
QRadioButton* aRadioButton2 = new QRadioButton(aConstructorsBox);
|
||||||
aRadioButton2->setIcon(iconWithElem);
|
aRadioButton2->setIcon(iconWithElem);
|
||||||
|
QRadioButton* aRadioButton3 = new QRadioButton(aConstructorsBox);
|
||||||
|
aRadioButton3->setIcon(iconElemOnly);
|
||||||
|
|
||||||
aConstructorsBoxLayout->addWidget(aRadioButton1);
|
aConstructorsBoxLayout->addWidget(aRadioButton1);
|
||||||
aConstructorsBoxLayout->addWidget(aRadioButton2);
|
aConstructorsBoxLayout->addWidget(aRadioButton2);
|
||||||
|
aConstructorsBoxLayout->addWidget(aRadioButton3);
|
||||||
myGroupConstructors->addButton(aRadioButton1, 0);
|
myGroupConstructors->addButton(aRadioButton1, 0);
|
||||||
myGroupConstructors->addButton(aRadioButton2, 1);
|
myGroupConstructors->addButton(aRadioButton2, 1);
|
||||||
|
myGroupConstructors->addButton(aRadioButton3, 2);
|
||||||
|
|
||||||
// Arguments
|
// Arguments
|
||||||
myGroupArguments = new QGroupBox(this);
|
myGroupArguments = new QGroupBox(this);
|
||||||
@ -200,6 +207,9 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
|
|||||||
aMainLayout->addWidget(myGroupArguments);
|
aMainLayout->addWidget(myGroupArguments);
|
||||||
aMainLayout->addWidget(aGroupButtons);
|
aMainLayout->addWidget(aGroupButtons);
|
||||||
|
|
||||||
|
myCheckBoxNewElemGroup->setChecked(true);
|
||||||
|
myCheckBoxNewNodeGroup->setChecked(true);
|
||||||
|
|
||||||
// Initialize the dialog
|
// Initialize the dialog
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
@ -237,8 +247,6 @@ SMESHGUI_DuplicateNodesDlg::~SMESHGUI_DuplicateNodesDlg()
|
|||||||
void SMESHGUI_DuplicateNodesDlg::Init()
|
void SMESHGUI_DuplicateNodesDlg::Init()
|
||||||
{
|
{
|
||||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||||
myCheckBoxNewElemGroup->setChecked(true);
|
|
||||||
myCheckBoxNewNodeGroup->setChecked(true);
|
|
||||||
|
|
||||||
// Set initial parameters
|
// Set initial parameters
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
@ -316,6 +324,25 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
|
|||||||
mySelectButton3->show();
|
mySelectButton3->show();
|
||||||
myLineEdit3->show();
|
myLineEdit3->show();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
// Set text to the group of arguments and to all the labels
|
||||||
|
myGroupArguments->setTitle(tr("DUPLICATION_ONLY_ELEMS"));
|
||||||
|
myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE"));
|
||||||
|
|
||||||
|
myCheckBoxNewElemGroup->show();
|
||||||
|
myCheckBoxNewNodeGroup->hide();
|
||||||
|
|
||||||
|
// Hide the second and the third field
|
||||||
|
myTextLabel2->hide();
|
||||||
|
mySelectButton2->hide();
|
||||||
|
myLineEdit2->hide();
|
||||||
|
myTextLabel3->hide();
|
||||||
|
mySelectButton3->hide();
|
||||||
|
myLineEdit3->hide();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,17 +363,20 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
|
|
||||||
bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked();
|
bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked();
|
||||||
bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked();
|
bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked();
|
||||||
int operationMode = myGroupConstructors->checkedId();
|
int operationMode = myGroupConstructors->checkedId();
|
||||||
|
|
||||||
// Apply changes
|
// Apply changes
|
||||||
bool result = false;
|
bool result = false;
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
QStringList anEntryList;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
|
SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
||||||
|
|
||||||
if ( operationMode == 0 ) {
|
switch ( operationMode ) {
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
||||||
g1->length( myGroups1.count() );
|
g1->length( myGroups1.count() );
|
||||||
for ( int i = 0; i < myGroups1.count(); i++ )
|
for ( int i = 0; i < myGroups1.count(); i++ )
|
||||||
@ -364,8 +394,10 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
else {
|
else {
|
||||||
result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
|
result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
case 1:
|
||||||
|
{
|
||||||
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
||||||
g1->length( myGroups1.count() );
|
g1->length( myGroups1.count() );
|
||||||
for ( int i = 0; i < myGroups1.count(); i++ )
|
for ( int i = 0; i < myGroups1.count(); i++ )
|
||||||
@ -388,6 +420,31 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
else {
|
else {
|
||||||
result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
|
result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
QString groupName;
|
||||||
|
if ( toCreateElemGroup )
|
||||||
|
groupName = SMESH::UniqueName("DoubleElements");
|
||||||
|
for ( int i = 0; i < myGroups1.count(); i++ )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_Group_var group =
|
||||||
|
aMeshEditor->DoubleElements( myGroups1[i], groupName.toLatin1().data() );
|
||||||
|
if ( group->_is_nil() )
|
||||||
|
{
|
||||||
|
if ( toCreateElemGroup )
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( _PTR(SObject) so = SMESH::FindSObject( group ))
|
||||||
|
anEntryList.append( so->GetID().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
@ -396,7 +453,7 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
catch ( const std::exception& exc ) {
|
catch ( const std::exception& exc ) {
|
||||||
INFOS( "Follow exception was cought:\n\t" << exc.what() );
|
INFOS( "Follow exception was cought:\n\t" << exc.what() );
|
||||||
}
|
}
|
||||||
catch (...){
|
catch (...) {
|
||||||
INFOS( "Unknown exception was cought !!!" );
|
INFOS( "Unknown exception was cought !!!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,9 +470,14 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
SMESHGUI::Modified();
|
SMESHGUI::Modified();
|
||||||
mySMESHGUI->updateObjBrowser(true);
|
mySMESHGUI->updateObjBrowser(true);
|
||||||
|
|
||||||
|
if ( !anEntryList.isEmpty())
|
||||||
|
if( LightApp_Application* anApp =
|
||||||
|
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ))
|
||||||
|
anApp->browseObjects( anEntryList, true, false );
|
||||||
|
|
||||||
// Reinitialize the dialog
|
// Reinitialize the dialog
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,15 +533,20 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
|
|||||||
// check group of proper type is selected
|
// check group of proper type is selected
|
||||||
if ( ok ) {
|
if ( ok ) {
|
||||||
SMESH::ElementType aGroupType = aGroup->GetType();
|
SMESH::ElementType aGroupType = aGroup->GetType();
|
||||||
if ( operationMode == 0 ) {
|
switch ( operationMode ) {
|
||||||
|
case 0:
|
||||||
ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
|
ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
|
||||||
( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
|
( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
|
||||||
}
|
break;
|
||||||
else {
|
case 1:
|
||||||
ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
|
ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
|
||||||
aGroupType == SMESH::FACE ) ) ||
|
aGroupType == SMESH::FACE ) ) ||
|
||||||
( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE ) ||
|
( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE ) ||
|
||||||
( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
|
( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ok = ( aGroupType != SMESH::NODE );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ok ) aGroups << aGroup;
|
if ( ok ) aGroups << aGroup;
|
||||||
@ -533,7 +600,7 @@ void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument()
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Check if the input data is valid.
|
\brief Check if the input data is valid.
|
||||||
\return \c true id the data is valid
|
\return \c true if the data is valid
|
||||||
*/
|
*/
|
||||||
bool SMESHGUI_DuplicateNodesDlg::isValid()
|
bool SMESHGUI_DuplicateNodesDlg::isValid()
|
||||||
{
|
{
|
||||||
|
@ -435,6 +435,10 @@
|
|||||||
<source>ICON_SMESH_DUPLICATE_NODES_WITH_ELEM</source>
|
<source>ICON_SMESH_DUPLICATE_NODES_WITH_ELEM</source>
|
||||||
<translation>mesh_duplicate_nodes_with_elem.png</translation>
|
<translation>mesh_duplicate_nodes_with_elem.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_SMESH_DUPLICATE_ELEM_ONLY</source>
|
||||||
|
<translation>mesh_duplicate_elem_only.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_SMESH_TREE_ALGO</source>
|
<source>ICON_SMESH_TREE_ALGO</source>
|
||||||
<translation>mesh_tree_algo.png</translation>
|
<translation>mesh_tree_algo.png</translation>
|
||||||
|
@ -946,7 +946,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_DUPLICATE_NODES</source>
|
<source>MEN_DUPLICATE_NODES</source>
|
||||||
<translation>Duplicate Nodes</translation>
|
<translation>Duplicate Nodes or/and Elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_TRANSF</source>
|
<source>MEN_TRANSF</source>
|
||||||
@ -2555,7 +2555,7 @@ Check algorithm documentation for supported geometry</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_DUPLICATE_TITLE</source>
|
<source>SMESH_DUPLICATE_TITLE</source>
|
||||||
<translation>Duplicate Nodes</translation>
|
<translation>Duplicate Nodes and/or Elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_SCALE</source>
|
<source>SMESH_SCALE</source>
|
||||||
@ -3283,7 +3283,7 @@ Please check preferences of Mesh module.
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_DUPLICATE_NODES</source>
|
<source>STB_DUPLICATE_NODES</source>
|
||||||
<translation>Duplicate Nodes</translation>
|
<translation>Duplicate Nodes or/and Elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_TRANSP</source>
|
<source>STB_TRANSP</source>
|
||||||
@ -3891,7 +3891,7 @@ Please check preferences of Mesh module.
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_DUPLICATE_NODES</source>
|
<source>TOP_DUPLICATE_NODES</source>
|
||||||
<translation>Duplicate Nodes</translation>
|
<translation>Duplicate Nodes or/and Elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_TRANSP</source>
|
<source>TOP_TRANSP</source>
|
||||||
@ -6463,7 +6463,7 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>DUPLICATION_WITHOUT_ELEMS</source>
|
<source>DUPLICATION_WITHOUT_ELEMS</source>
|
||||||
<translation>Without duplication of border elements</translation>
|
<translation>Duplicate nodes only</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GROUP_NODES_TO_DUPLICATE</source>
|
<source>GROUP_NODES_TO_DUPLICATE</source>
|
||||||
@ -6475,7 +6475,11 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>DUPLICATION_WITH_ELEMS</source>
|
<source>DUPLICATION_WITH_ELEMS</source>
|
||||||
<translation>With duplication of border elements</translation>
|
<translation>Duplicate nodes and border elements</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>DUPLICATION_ONLY_ELEMS</source>
|
||||||
|
<translation>Duplicate elements only</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GROUP_ELEMS_TO_DUPLICATE</source>
|
<source>GROUP_ELEMS_TO_DUPLICATE</source>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user