Salome HOME
PAL16842 (Genertion of groups when a mesh is transformed)
authoreap <eap@opencascade.com>
Mon, 12 Nov 2007 10:00:16 +0000 (10:00 +0000)
committereap <eap@opencascade.com>
Mon, 12 Nov 2007 10:00:16 +0000 (10:00 +0000)
+  QCheckBox*        MakeGroupsCheck;

13 files changed:
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.h
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.h
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.h
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.h
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.h
src/SMESHGUI/SMESH_msg_en.po

index 8a3c0c07bcc245ee914c7c81ff231c5b64f2b6ff..510e578aa2e20f83f98fc643b646e9d9c62f37e8 100644 (file)
@@ -270,6 +270,10 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   AnglesGrpLayout->addWidget(         AngleSpin,  0,    2   );
   AnglesGrpLayout->setRowStretch(1, 10);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(true);
+
   // layouting
   GroupArgumentsLayout->addWidget(         ElementsLab,            0,    0   );
   GroupArgumentsLayout->addWidget(         SelectElementsButton,   0,    1   );
@@ -280,6 +284,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   GroupArgumentsLayout->addMultiCellWidget(BasePointGrp,           3, 4, 1, 2);
   GroupArgumentsLayout->addWidget(         AnglesCheck,            5,    0   );
   GroupArgumentsLayout->addMultiCellWidget(AnglesGrp,              5, 6, 1, 2);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck,        7, 7, 0, 2);
   GroupArgumentsLayout->setRowStretch(6, 10);
 
   /***************************************************************/
@@ -599,10 +604,18 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
   try {
     SUIT_OverrideCursor wc;
     SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-    SMESH::SMESH_MeshEditor::Extrusion_Error retVal =
-      aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh, myPathShape, aNodeStart,
-                                      AnglesCheck->isChecked(), anAngles.inout(),
-                                      BasePointCheck->isChecked(), aBasePoint);
+    SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      SMESH::ListOfGroups_var groups = 
+        aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId.inout(), myPathMesh,
+                                                  myPathShape, aNodeStart,
+                                                  AnglesCheck->isChecked(), anAngles.inout(),
+                                                  BasePointCheck->isChecked(), aBasePoint, retVal);
+    else
+      retVal = aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh,
+                                               myPathShape, aNodeStart,
+                                               AnglesCheck->isChecked(), anAngles.inout(),
+                                               BasePointCheck->isChecked(), aBasePoint);
 
     //wc.stop();
     wc.suspend();
@@ -652,6 +665,8 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
 
   //mySelectionMgr->clearSelected();
   SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() );
+  if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+    mySMESHGUI->updateObjBrowser(true); // new groups may appear
   //SMESH::UpdateView();
   Init(false);
   ConstructorsClicked(GetConstructorId());
@@ -819,6 +834,14 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
     myMesh = SMESH::GetMeshByIO(IO);
     if (myMesh->_is_nil())
       return;
+
+    // MakeGroups is available if there are groups
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    } else {
+      MakeGroupsCheck->setEnabled(true);
+    }
     // find actor
     myMeshActor = SMESH::FindActorByObject(myMesh);
     if (!myMeshActor)
index 158c1551cb498e3f15dfaae67d625f42183b57dc..6bcdbf2ced962d12e2d7ca713059cf6e9994dafd 100644 (file)
@@ -139,6 +139,7 @@ private:
   SMESHGUI_SpinBox* YSpin;
   QLabel*           ZLab;
   SMESHGUI_SpinBox* ZSpin;
+  QCheckBox*        MakeGroupsCheck;
 
   QGroupBox*        GroupButtons;
   QPushButton*      OkButton;
index 44b94896fed284df09eb120afa121f8d649d0d3c..5a8acf561d4ccbb4509df58da3ea207c2ee234b0 100644 (file)
@@ -225,6 +225,12 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
   SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
   GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3,  2, 7);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(true);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 4, 4,  0, 7);
+
+
   SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0);
 
   /* Initialisations */
@@ -401,12 +407,20 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
+      else
+        aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
     SelectionIntoArgument();
@@ -556,6 +570,14 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == LineEditElements) {
     int aNbElements = 0;
 
+    // MakeGroups is available if there are groups
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    } else {
+      MakeGroupsCheck->setEnabled(true);
+    }
+
     if (CheckBoxMesh->isChecked()) {
       SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
 
index bcdf49e03d326718368095801c87b66d11ce66a8..fe6d6959a2fe16c7997f73454fbecd8c136c07d8 100644 (file)
@@ -110,6 +110,7 @@ private:
   SMESHGUI_SpinBox* SpinBox_Dz;
   QLabel*           TextLabelNbSteps;
   QSpinBox*         SpinBox_NbSteps;
+  QCheckBox*        MakeGroupsCheck;
 
   QGroupBox*        GroupButtons;
   QPushButton*      buttonOk;
index 9dc5826f9da17d2c6f31ea38dc612ddf4b376aaf..611445e52b3bf14a65d749cf244617fbd8a5e377 100644 (file)
@@ -290,6 +290,12 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
   GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(true);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 6, 6, 0, 3);
+
+
   SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0);
 
   /* Initialisations */
@@ -479,12 +485,21 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
+                                               anAngle, aNbSteps, aTolerance);
+      else
+        aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
     SelectionIntoArgument();
@@ -634,6 +649,14 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
 
+    // MakeGroups is available if there are groups
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    } else {
+      MakeGroupsCheck->setEnabled(true);
+    }
+
     if (CheckBoxMesh->isChecked()) {
       int aConstructorId = GetConstructorId();
 
index 49b391e3cb47f6b3780efc228209ca36aa887bd6..5e2b2bc937d697b0d9acde950a7c98f5db518f67 100644 (file)
@@ -108,6 +108,7 @@ private:
     QPushButton* SelectElementsButton;
     QLineEdit* LineEditElements;
     QCheckBox* CheckBoxMesh;
+    QCheckBox* MakeGroupsCheck;
 
     QLabel* TextLabelPoint;
     QPushButton* SelectPointButton;
index e52b6b048051fdb4dd1b5910c327b3521f5af162..10f1092228dfefc3fe4b8d8872c7d18ce81c1013 100644 (file)
@@ -283,6 +283,10 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
   GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
+
   SMESHGUI_RotationDlgLayout->addWidget(GroupArguments, 1, 0);
 
   /* Initialisations */
@@ -339,6 +343,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
+  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                  SLOT(onCopyChecked(bool)));
 
   this->show(); /* displays Dialog */
 
@@ -386,6 +391,8 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
 
     CheckBoxCopy->setChecked(false);
     CheckBoxMesh->setChecked(false);
+    MakeGroupsCheck->setChecked(false);
+    MakeGroupsCheck->setEnabled(false);
   }
 
   onSelectMesh(CheckBoxMesh->isChecked());
@@ -432,12 +439,18 @@ void SMESHGUI_RotationDlg::ClickOnApply()
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->RotateMakeGroups(anElementsId.inout(), anAxis, anAngle);
+      else
+        aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     SelectionIntoArgument();
   }
@@ -586,6 +599,14 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
 
+    // MakeGroups is available if there are groups and "Copy"
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    }
+    else if (CheckBoxCopy->isChecked() ) {
+      MakeGroupsCheck->setEnabled(true);
+    }
     if (CheckBoxMesh->isChecked()) {
       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
 
@@ -848,6 +869,19 @@ void SMESHGUI_RotationDlg::onVectorChanged()
   }
 }
 
+//=======================================================================
+//function : onCopyChecked
+//purpose  : slot called when Copy checkBox is checked
+//=======================================================================
+
+void SMESHGUI_RotationDlg::onCopyChecked(bool isOn)
+{
+  // enable "MakeGroupsCheck"
+  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
+    isOn = false;
+  MakeGroupsCheck->setEnabled(isOn);
+}
+
 //=================================================================================
 // function : keyPressEvent()
 // purpose  :
index 921202eadac293ee1bd0e2503653aa6e9a25b225..ceebea7cf3c00277430d90e82fad34397fc96e03 100644 (file)
@@ -127,6 +127,7 @@ private:
     QLabel* TextLabelAngle;
     SMESHGUI_SpinBox* SpinBox_Angle;
     QCheckBox* CheckBoxCopy;
+    QCheckBox* MakeGroupsCheck;
 
     QString myHelpFileName;
 
@@ -144,6 +145,7 @@ private slots:
     void onTextChange (const QString&);
     void onSelectMesh (bool toSelectMesh);
     void onVectorChanged();
+    void onCopyChecked(bool isOn);
 
 protected:
     QGridLayout* SMESHGUI_RotationDlgLayout;
index 9bfe6af0d47e16f67d8918f48c449f980228fec3..9ee18b07528ef8edda848db848d5d9baf1132a6c 100644 (file)
@@ -277,6 +277,10 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
   CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
   GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 3, 3, 0, 2);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(false);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 4, 4, 0, 2);
 
   SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -331,6 +335,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
   connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
+  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                 SLOT(onCopyChecked(bool)));
 
   this->show(); /* displays Dialog */
 
@@ -377,6 +382,8 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
 
     CheckBoxCopy->setChecked(false);
     CheckBoxMesh->setChecked(false);
+    MakeGroupsCheck->setChecked(false);
+    MakeGroupsCheck->setEnabled(false);
     onSelectMesh(false);
   }
 }
@@ -492,12 +499,18 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
+      else
+        aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
     SelectionIntoArgument();
@@ -648,6 +661,14 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
 
+    // MakeGroups is available if there are groups and "Copy"
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    }
+    else if (CheckBoxCopy->isChecked() ) {
+      MakeGroupsCheck->setEnabled(true);
+    }
     if (CheckBoxMesh->isChecked()) {
       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
 
@@ -921,6 +942,19 @@ void SMESHGUI_SymmetryDlg::onVectorChanged()
   }
 }
 
+//=======================================================================
+//function : onCopyChecked
+//purpose  : slot called when Copy checkBox is checked
+//=======================================================================
+
+void SMESHGUI_SymmetryDlg::onCopyChecked(bool isOn)
+{
+  // enable "MakeGroupsCheck"
+  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
+    isOn = false;
+  MakeGroupsCheck->setEnabled(isOn);
+}
+
 //=================================================================================
 // function : keyPressEvent()
 // purpose  :
index 07a54ffd200335adc85503a3512296d71e76b336..c09a35a028d99d54fdcb8f8814d05f087b83d61a 100644 (file)
@@ -127,6 +127,7 @@ private:
     SMESHGUI_SpinBox* SpinBox_DZ;
     
     QCheckBox* CheckBoxCopy;
+    QCheckBox* MakeGroupsCheck;
 
     QString myHelpFileName;
    
@@ -144,7 +145,8 @@ private:
     void onTextChange(const QString&);
     void onSelectMesh(bool toSelectMesh);
     void onVectorChanged();
-    
+    void onCopyChecked(bool isOn);
+
 protected:
     QGridLayout* SMESHGUI_SymmetryDlgLayout;
     QGridLayout* GroupConstructorsLayout;
index 9711cdc474f0664fbda4397efbffe5bd3d4e70bf..2a73f6a9b7b4d7072f4b57082c13b401b01fe78b 100644 (file)
@@ -260,6 +260,10 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
   CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
   GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
 
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(false);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
 
   SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -310,6 +314,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
+  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                  SLOT(onCopyChecked(bool)));
 
   this->show(); /* displays Dialog */
 
@@ -356,6 +361,8 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
 
     CheckBoxCopy->setChecked(false);
     CheckBoxMesh->setChecked(false);
+    MakeGroupsCheck->setChecked(false);
+    MakeGroupsCheck->setEnabled(false);
     onSelectMesh(false);
   }
 }
@@ -457,12 +464,18 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->TranslateMakeGroups(anElementsId.inout(), aVector);
+      else
+        aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
     SelectionIntoArgument();
@@ -613,6 +626,15 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
 
+    // MakeGroups is available if there are groups and "Copy"
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    }
+    else if (CheckBoxCopy->isChecked() ) {
+      MakeGroupsCheck->setEnabled(true);
+    }
+
     if (CheckBoxMesh->isChecked()) {
       SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
 
@@ -846,6 +868,19 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
   SelectionIntoArgument();
 }
 
+//=======================================================================
+//function : onCopyChecked
+//purpose  : slot called when Copy checkBox is checked
+//=======================================================================
+
+void SMESHGUI_TranslationDlg::onCopyChecked(bool isOn)
+{
+  // enable "MakeGroupsCheck"
+  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
+    isOn = false;
+  MakeGroupsCheck->setEnabled(isOn);
+}
+
 //=================================================================================
 // function : GetConstructorId()
 // purpose  :
index 66330d4b78f1a99f200db8d58e7ec01176dd216e..2188bc54d1c196406d9b4b91377aaa9e021010db 100644 (file)
@@ -122,6 +122,7 @@ private:
     QLabel* TextLabel2_3;
     SMESHGUI_SpinBox* SpinBox2_3;
     QCheckBox* CheckBoxCopy;
+    QCheckBox* MakeGroupsCheck;
 
     QString myHelpFileName;
    
@@ -138,6 +139,7 @@ private:
     void ActivateThisDialog() ;
     void onTextChange(const QString&);
     void onSelectMesh(bool toSelectMesh);
+    void onCopyChecked(bool isOn);
     
 protected:
     QGridLayout* SMESHGUI_TranslationDlgLayout;
index 2819b263d1841a8e40df79e803810dd9c7c65062..1c1c76186c76fd7c71f2cd0f763534924cd31fd2 100644 (file)
@@ -196,6 +196,10 @@ msgstr "Polyedron creation error"
 msgid "SMESH_EXPORT_FAILED"
 msgstr "Mesh export failed.\nProbably, there is not enough space on disk."
 
+# Generate groups at mesh transformation
+msgid "SMESH_MAKE_GROUPS"
+msgstr "Generate groups"
+
 #-------------------------------------------------------------------------
 # MEN
 #-------------------------------------------------------------------------