mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
0019970: create groups automatically
remove "Name" lineEdit
This commit is contained in:
parent
424dd73b1b
commit
591c0c3f5c
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 19 KiB |
@ -78,7 +78,7 @@ a new group of mesh elements will be created.
|
|||||||
To create multiple groups on geometry of both nodes and elements of
|
To create multiple groups on geometry of both nodes and elements of
|
||||||
any type at once, in the \b Mesh menu select <b>Create Groups from
|
any type at once, in the \b Mesh menu select <b>Create Groups from
|
||||||
Geometry</b>.<br>
|
Geometry</b>.<br>
|
||||||
Unique group names are generated by appending a number to \b Name.
|
Group names are same as those of geometrical objects.
|
||||||
Type of group of mesh elements is defined automatically by
|
Type of group of mesh elements is defined automatically by
|
||||||
<b>Geometrical object</b> nature.
|
<b>Geometrical object</b> nature.
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ SMESHGUI_GroupOnShapeDlg::SMESHGUI_GroupOnShapeDlg()
|
|||||||
QPixmap image (resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
QPixmap image (resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
QLabel* nameLabel = new QLabel( tr( "SMESH_NAME" ), mainFrame() );
|
//QLabel* nameLabel = new QLabel( tr( "SMESH_NAME" ), mainFrame() );
|
||||||
myGrpNameLine = new QLineEdit( mainFrame() );
|
//myGrpNameLine = new QLineEdit( mainFrame() );
|
||||||
|
|
||||||
// Mesh
|
// Mesh
|
||||||
QLabel* meshLabel = new QLabel( tr( "SMESH_OBJECT_MESH" ), mainFrame() );
|
QLabel* meshLabel = new QLabel( tr( "SMESH_OBJECT_MESH" ), mainFrame() );
|
||||||
@ -116,8 +116,8 @@ SMESHGUI_GroupOnShapeDlg::SMESHGUI_GroupOnShapeDlg()
|
|||||||
QGridLayout* aLay = new QGridLayout( mainFrame());
|
QGridLayout* aLay = new QGridLayout( mainFrame());
|
||||||
aLay->setSpacing( SPACING );
|
aLay->setSpacing( SPACING );
|
||||||
aLay->setMargin( MARGIN );
|
aLay->setMargin( MARGIN );
|
||||||
aLay->addWidget( nameLabel, 0, 0 );
|
//aLay->addWidget( nameLabel, 0, 0 );
|
||||||
aLay->addWidget( myGrpNameLine, 0, 2 );
|
//aLay->addWidget( myGrpNameLine, 0, 2 );
|
||||||
aLay->addWidget( meshLabel, 1, 0 );
|
aLay->addWidget( meshLabel, 1, 0 );
|
||||||
aLay->addWidget( myMeshBtn, 1, 1 );
|
aLay->addWidget( myMeshBtn, 1, 1 );
|
||||||
aLay->addWidget( myMeshLine,1, 2 );
|
aLay->addWidget( myMeshLine,1, 2 );
|
||||||
@ -140,7 +140,7 @@ SMESHGUI_GroupOnShapeDlg::~SMESHGUI_GroupOnShapeDlg()
|
|||||||
void SMESHGUI_GroupOnShapeDlg::updateButtons()
|
void SMESHGUI_GroupOnShapeDlg::updateButtons()
|
||||||
{
|
{
|
||||||
bool enable =
|
bool enable =
|
||||||
!myGrpNameLine->text().isEmpty() && myElemGeomList->count() + myNodeGeomList->count();
|
/*!myGrpNameLine->text().isEmpty() &&*/ myElemGeomList->count() + myNodeGeomList->count();
|
||||||
|
|
||||||
button(Apply)->setEnabled( enable );
|
button(Apply)->setEnabled( enable );
|
||||||
button(OK)->setEnabled( enable );
|
button(OK)->setEnabled( enable );
|
||||||
@ -154,7 +154,7 @@ void SMESHGUI_GroupOnShapeDlg::updateButtons()
|
|||||||
|
|
||||||
void SMESHGUI_GroupOnShapeDlg::init()
|
void SMESHGUI_GroupOnShapeDlg::init()
|
||||||
{
|
{
|
||||||
myGrpNameLine->setText("");
|
//myGrpNameLine->setText("");
|
||||||
|
|
||||||
myMeshBtn->setChecked( true );
|
myMeshBtn->setChecked( true );
|
||||||
myMeshLine->setText("");
|
myMeshLine->setText("");
|
||||||
@ -277,7 +277,7 @@ void SMESHGUI_GroupOnShapeOp::startOperation()
|
|||||||
connect(myDlg->myMeshBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
connect(myDlg->myMeshBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
||||||
connect(myDlg->myElemGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
connect(myDlg->myElemGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
||||||
connect(myDlg->myNodeGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
connect(myDlg->myNodeGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
|
||||||
connect(myDlg->myGrpNameLine, SIGNAL(textChanged(const QString&)),myDlg,SLOT(updateButtons()));
|
//connect(myDlg->myGrpNameLine, SIGNAL(textChanged(const QString&)),myDlg,SLOT(updateButtons()));
|
||||||
}
|
}
|
||||||
SMESHGUI_SelectionOp::startOperation();
|
SMESHGUI_SelectionOp::startOperation();
|
||||||
|
|
||||||
@ -308,12 +308,15 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
|
|||||||
if ( mesh->_is_nil() ) return false;
|
if ( mesh->_is_nil() ) return false;
|
||||||
|
|
||||||
// names of all existing groups
|
// names of all existing groups
|
||||||
SMESH::ListOfGroups_var groups = mesh->GetGroups();
|
// QStringList groupNames;
|
||||||
QStringList groupNames;
|
// QString givenName = myDlg->myGrpNameLine->text();
|
||||||
for ( int i = 0; i < groups->length(); ++i ) {
|
// if ( !givenName.isEmpty() ) {
|
||||||
CORBA::String_var name = groups[i]->GetName();
|
// SMESH::ListOfGroups_var groups = mesh->GetGroups();
|
||||||
groupNames.append( name.in() );
|
// for ( int i = 0; i < groups->length(); ++i ) {
|
||||||
}
|
// CORBA::String_var name = groups[i]->GetName();
|
||||||
|
// groupNames.append( name.in() );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// create groups
|
// create groups
|
||||||
SMESH::SMESH_GroupOnGeom_var group;
|
SMESH::SMESH_GroupOnGeom_var group;
|
||||||
@ -322,7 +325,7 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
|
|||||||
QStringList::iterator geomID = isNode ? myNodeGeoIDs.begin() : myElemGeoIDs.begin();
|
QStringList::iterator geomID = isNode ? myNodeGeoIDs.begin() : myElemGeoIDs.begin();
|
||||||
QStringList::iterator geomEnd = isNode ? myNodeGeoIDs.end() : myElemGeoIDs.end();
|
QStringList::iterator geomEnd = isNode ? myNodeGeoIDs.end() : myElemGeoIDs.end();
|
||||||
|
|
||||||
for ( ; geomID != geomEnd; ++geomID )
|
for ( int i = 0; geomID != geomEnd; ++geomID, ++i )
|
||||||
{
|
{
|
||||||
// selected geom
|
// selected geom
|
||||||
_PTR(SObject) geomSO = aStudy->FindObjectID( geomID->toLatin1().data() );
|
_PTR(SObject) geomSO = aStudy->FindObjectID( geomID->toLatin1().data() );
|
||||||
@ -335,11 +338,13 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// make a unique name
|
// make a unique name
|
||||||
int nb = 1;
|
QString name =
|
||||||
QString name = myDlg->myGrpNameLine->text() + "_" + QString::number(nb);
|
isNode ? myDlg->myNodeGeomList->item(i)->text() : myDlg->myElemGeomList->item(i)->text();
|
||||||
while ( groupNames.contains( name ))
|
// int nb = 1;
|
||||||
name = myDlg->myGrpNameLine->text() + "_" + QString::number(++nb);
|
// QString name = myDlg->myGrpNameLine->text() + "_" + QString::number(nb);
|
||||||
groupNames.append( name );
|
// while ( groupNames.contains( name ))
|
||||||
|
// name = myDlg->myGrpNameLine->text() + "_" + QString::number(++nb);
|
||||||
|
// groupNames.append( name );
|
||||||
|
|
||||||
//printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() );
|
//printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() );
|
||||||
group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom );
|
group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom );
|
||||||
|
@ -105,7 +105,7 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QLineEdit* myGrpNameLine;
|
//QLineEdit* myGrpNameLine;
|
||||||
|
|
||||||
QPushButton* myMeshBtn;
|
QPushButton* myMeshBtn;
|
||||||
QLineEdit* myMeshLine;
|
QLineEdit* myMeshLine;
|
||||||
|
Loading…
Reference in New Issue
Block a user