Salome HOME
Dump Python Extension - Debug
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RevolutionDlg.cxx
index d5fe19e5fa9b6f3af983753a19bbfd3dbd5e80e9..04772d3ec6e36775e593e0d7c0ccc4d3b54d7886 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_MeshEditPreview.h"
 
 #include <SMESH_Actor.h>
 #include <SMESH_TypeFilter.hxx>
 #include <SUIT_Session.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_Desktop.h>
+#include <SUIT_OverrideCursor.h>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_IntSpinBox.h>
 
 #include <SVTK_ViewWindow.h>
 #include <SVTK_Selector.h>
 #include <SALOME_ListIO.hxx>
+#include <VTKViewer_CellLocationsArray.h>
 
 // OCCT includes
 #include <TColStd_MapOfInteger.hxx>
@@ -66,7 +71,6 @@
 #include <QHBoxLayout>
 #include <QVBoxLayout>
 #include <QGridLayout>
-#include <QSpinBox>
 #include <QKeyEvent>
 
 // IDL includes
 SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   : QDialog( SMESH::GetDesktop( theModule ) ),
     mySMESHGUI( theModule ),
-    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+    mySelectedObject(SMESH::SMESH_IDSource::_nil())
 {
+  mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+
   SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
   QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
   QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
@@ -186,18 +193,38 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   GroupAxisLayout->addWidget(TextLabelDZ,        1, 6);
   GroupAxisLayout->addWidget(SpinBox_DZ,         1, 7);
 
-  // Controls for angle defining
-  TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments);
-  SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments);
+  // Controls for angle defining & number of steps defining
+  GroupAngleBox = new QGroupBox(tr("SMESH_ANGLE"), GroupArguments);
+  GroupAngle = new QButtonGroup(GroupAngleBox);
+  QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngleBox);
+  GroupAngleLayout->setSpacing(6);
+  GroupAngleLayout->setMargin(11);
+
+  RadioButton3 = new QRadioButton(tr("ANGLE_BY_STEP"), GroupAngleBox);
+  RadioButton4 = new QRadioButton(tr("TOTAL_ANGLE"),   GroupAngleBox);
+  GroupAngle->addButton(RadioButton3, 0);
+  GroupAngle->addButton(RadioButton4, 1);
+
+  TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupAngleBox);
+  SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox);
 
-  // Controls for nb. steps defining
-  TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
-  SpinBox_NbSteps = new QSpinBox(GroupArguments);
+  TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupAngleBox);
+  SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupAngleBox);
+
+  GroupAngleLayout->addWidget(RadioButton3,     0, 0);
+  GroupAngleLayout->addWidget(RadioButton4,     0, 1);
+  GroupAngleLayout->addWidget(TextLabelAngle,   1, 0);
+  GroupAngleLayout->addWidget(SpinBox_Angle,    1, 1);
+  GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0);
+  GroupAngleLayout->addWidget(SpinBox_NbSteps,  2, 1);
 
   // Controls for tolerance defining
   TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupArguments);
   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments);
 
+  // Control for mesh preview
+  CheckBoxPreview = new QCheckBox(tr("PREVIEW"), GroupArguments);
+
   // CheckBox for groups generation
   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
   MakeGroupsCheck->setChecked(true);
@@ -207,12 +234,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 3);
   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 3);
-  GroupArgumentsLayout->addWidget(TextLabelAngle,       3, 0, 1, 2);
-  GroupArgumentsLayout->addWidget(SpinBox_Angle,        3, 2);
-  GroupArgumentsLayout->addWidget(TextLabelNbSteps,     4, 0, 1, 2);
-  GroupArgumentsLayout->addWidget(SpinBox_NbSteps,      4, 2);
-  GroupArgumentsLayout->addWidget(TextLabelTolerance,   5, 0, 1, 2);
-  GroupArgumentsLayout->addWidget(SpinBox_Tolerance,    5, 2);
+  GroupArgumentsLayout->addWidget(GroupAngleBox,        3, 0, 1, 3);
+  GroupArgumentsLayout->addWidget(TextLabelTolerance,   4, 0, 1, 2);
+  GroupArgumentsLayout->addWidget(SpinBox_Tolerance,    4, 2);
+  GroupArgumentsLayout->addWidget(CheckBoxPreview,      5, 0, 1, 3);
   GroupArgumentsLayout->addWidget(MakeGroupsCheck,      6, 0, 1, 3);
 
   /***************************************************************/
@@ -221,7 +246,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   GroupButtonsLayout->setSpacing(SPACING);
   GroupButtonsLayout->setMargin(MARGIN);
   
-  buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+  buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
   buttonOk->setAutoDefault(true);
   buttonOk->setDefault(true);
   buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
@@ -252,6 +277,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
 
+  RadioButton3->setChecked(true);
+
   SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3);
 
   SpinBox_NbSteps->setRange(1, 999999);
@@ -290,6 +317,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   connect(SelectPointButton,    SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(SelectVectorButton,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
+  connect(SpinBox_X,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Y,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Z,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+
   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
@@ -301,6 +332,14 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
 
+  connect(GroupAngle,        SIGNAL(buttonClicked(int)),   this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Angle,     SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_NbSteps,   SIGNAL(valueChanged(int)),    this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(CheckBoxPreview,   SIGNAL(toggled(bool)),        this, SLOT(onDisplaySimulation(bool)));
+
+  connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
+
   ConstructorsClicked(0);
   SelectionIntoArgument();
 }
@@ -311,7 +350,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
 //=================================================================================
 SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
 {
-  // no need to delete child widgets, Qt does it all for us
+  delete mySimulation;
 }
 
 //=================================================================================
@@ -344,6 +383,8 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 
     CheckBoxMesh->setChecked(false);
     onSelectMesh(false);
+    CheckBoxPreview->setChecked(false);
+    onDisplaySimulation(false);
   }
 }
 
@@ -353,7 +394,17 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelectionMgr, 0, this, 0);
+  //disconnect(mySelectionMgr, 0, this, 0);
+
+  SALOME_ListIO io;
+  mySelectionMgr->selectedObjects( io );
+  SALOME_ListIO aList;
+  mySelectionMgr->setSelectedObjects( aList );
+//   LineEditElements->clear();
+  myNbOkElements = 0;
+  buttonApply->setEnabled(false);
+  buttonOk->setEnabled(false);
+  mySimulation->SetVisibility(false);
 
   Selection_Mode aSelMode = ActorSelection;
 
@@ -388,17 +439,21 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
 
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  mySelectionMgr->setSelectedObjects( io );
 }
 
 //=================================================================================
 // function : ClickOnApply()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RevolutionDlg::ClickOnApply()
+bool SMESHGUI_RevolutionDlg::ClickOnApply()
 {
   if (mySMESHGUI->isActiveStudyLocked())
-    return;
+    return false;
+
+  if (!isValid())
+    return false;
 
   if (myNbOkElements && IsAxisOk()) {
     QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
@@ -422,18 +477,52 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
     long aNbSteps = (long)SpinBox_NbSteps->value();
     double aTolerance = SpinBox_Tolerance->GetValue();
 
+    if ( GroupAngle->checkedId() == 1 )
+      anAngle = anAngle/aNbSteps;
+
+    QStringList aParameters;
+    aParameters << SpinBox_X->text();
+    aParameters << SpinBox_Y->text();
+    aParameters << SpinBox_Z->text();
+    aParameters << SpinBox_DX->text();
+    aParameters << SpinBox_DY->text();
+    aParameters << SpinBox_DZ->text();
+    aParameters << SpinBox_Angle->text();
+    aParameters << SpinBox_NbSteps->text();
+    aParameters << SpinBox_Tolerance->text();
+
     try {
+      SUIT_OverrideCursor aWaitCursor;
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-      QApplication::setOverrideCursor(Qt::WaitCursor);
-
-      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);
+      
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
+        if( CheckBoxMesh->isChecked() ) {
+         if( GetConstructorId() == 0 )
+           SMESH::ListOfGroups_var groups = 
+             aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
+                                                          anAngle, aNbSteps, aTolerance);
+         else
+           SMESH::ListOfGroups_var groups = 
+             aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
+                                                          anAngle, aNbSteps, aTolerance);
+       }
+       else
+         SMESH::ListOfGroups_var groups = 
+           aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
+                                                anAngle, aNbSteps, aTolerance);
+      }
+      else {
+        if( CheckBoxMesh->isChecked() ) {
+         if( GetConstructorId() == 0 )
+           aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+         else
+           aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
+       }
+       else
+         aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+      }
 
-      QApplication::restoreOverrideCursor();
+      myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
     } catch (...) {
     }
 
@@ -442,8 +531,11 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
+    mySelectedObject = SMESH::SMESH_IDSource::_nil();
     SelectionIntoArgument();
   }
+
+  return true;
 }
 
 //=================================================================================
@@ -452,8 +544,8 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ClickOnOk()
 {
-  ClickOnApply();
-  ClickOnCancel();
+  if( ClickOnApply() )
+    ClickOnCancel();
 }
 
 //=================================================================================
@@ -496,6 +588,19 @@ void SMESHGUI_RevolutionDlg::ClickOnHelp()
   }
 }
 
+//=======================================================================
+// function : onAngleTextChange()
+// purpose  :
+//=======================================================================
+void SMESHGUI_RevolutionDlg::onAngleTextChange (const QString& theNewText)
+{
+  bool isNumber;
+  SpinBox_Angle->text().toDouble( &isNumber );
+  if( !isNumber )
+    RadioButton3->setChecked( true );
+  RadioButton4->setEnabled( isNumber );
+}
+
 //=======================================================================
 // function : onTextChange()
 // purpose  :
@@ -545,6 +650,7 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+  onDisplaySimulation(true);
 
   myBusy = false;
 }
@@ -605,77 +711,18 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     }
 
     if (CheckBoxMesh->isChecked()) {
-      int aConstructorId = GetConstructorId();
-
       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
 
-      if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
-        // get IDs from mesh
-        SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
-        if (!aSMDSMesh)
-          return;
-
-        if (aConstructorId == 0) {
-          SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
-
-          while (anIter->more()) {
-            const SMDS_MeshEdge * edge = anIter->next();
-            if (edge) {
-              myElementsId += QString(" %1").arg(edge->GetID());
-              aNbUnits++;
-            }
-          }
-        } else if (aConstructorId == 1) {
-          SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
-          while (anIter->more()) {
-            const SMDS_MeshFace * face = anIter->next();
-            if (face) {
-              myElementsId += QString(" %1").arg(face->GetID());
-              aNbUnits++;
-            }
-          }
-        }
-      } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
-        // get submesh
-        SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
-        // get IDs from submesh
-        SMESH::long_array_var anElementsIds = new SMESH::long_array;
-        if (aConstructorId == 0)
-          anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
-        else if (aConstructorId == 1)
-          anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
-
-        for (int i = 0; i < anElementsIds->length(); i++)
-          myElementsId += QString(" %1").arg(anElementsIds[i]);
-        aNbUnits = anElementsIds->length();
-      } else { // GROUP
-        // get smesh group
-        SMESH::SMESH_GroupBase_var aGroup =
-          SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
-        if (aGroup->_is_nil())
-          return;
-
-        if ((aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
-            (aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
-          return;
-
-        // get IDs from smesh group
-        SMESH::long_array_var anElementsIds = new SMESH::long_array;
-        anElementsIds = aGroup->GetListOfID();
-        for (int i = 0; i < anElementsIds->length(); i++) {
-          myElementsId += QString(" %1").arg(anElementsIds[i]);
-        }
-        aNbUnits = anElementsIds->length();
-      }
+      if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
+        mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+      else
+        return;
     } else {
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
+      if (aNbUnits < 1)
+       return;
     }
-
-    if (aNbUnits < 1)
-      return;
-
     myNbOkElements = true;
   } else {
     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
@@ -715,6 +762,8 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+
+  onDisplaySimulation(true);
 }
 
 //=================================================================================
@@ -730,6 +779,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
   mySelectionMgr->clearFilters();
 
   if (send == SelectElementsButton) {
+    mySimulation->SetVisibility(false);
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
     if (CheckBoxMesh->isChecked()) {
@@ -843,6 +893,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
+    mySimulation->SetVisibility(false);
     return;
   }
 
@@ -871,6 +922,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
     LineEditElements->setReadOnly(false);
     LineEditElements->setValidator(myIdValidator);
     onTextChange(LineEditElements->text());
+    mySimulation->SetVisibility(false);
   }
 
   SelectionIntoArgument();
@@ -909,6 +961,7 @@ void SMESHGUI_RevolutionDlg::onVectorChanged()
     buttonOk->setEnabled(false);
     buttonApply->setEnabled(false);
   }
+  onDisplaySimulation(true);
 }
 
 //=================================================================================
@@ -926,3 +979,109 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
     ClickOnHelp();
   }
 }
+
+//=================================================================================
+// function : toDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::toDisplaySimulation()
+{
+  onDisplaySimulation(true);
+}
+
+//=================================================================================
+// function : onDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
+{
+  if (CheckBoxPreview->isChecked() && toDisplayPreview)
+  {
+    //display preview
+    if (myNbOkElements && IsAxisOk())
+    {
+      QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+      
+      SMESH::long_array_var anElementsId = new SMESH::long_array;
+      
+      anElementsId->length(aListElementsId.count());
+      for (int i = 0; i < aListElementsId.count(); i++)
+       anElementsId[i] = aListElementsId[i].toInt();
+      
+      SMESH::AxisStruct anAxis;
+      
+      anAxis.x =  SpinBox_X->GetValue();
+      anAxis.y =  SpinBox_Y->GetValue();
+      anAxis.z =  SpinBox_Z->GetValue();
+      anAxis.vx = SpinBox_DX->GetValue();
+      anAxis.vy = SpinBox_DY->GetValue();
+      anAxis.vz = SpinBox_DZ->GetValue();
+      
+      double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+      long aNbSteps = (long)SpinBox_NbSteps->value();
+      double aTolerance = SpinBox_Tolerance->GetValue();
+      
+      if (GroupAngle->checkedId() == 1)
+       anAngle = anAngle/aNbSteps;
+      
+      try {
+       SUIT_OverrideCursor aWaitCursor;
+       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+        if( CheckBoxMesh->isChecked() ) {
+         if( GetConstructorId() == 0 )
+           aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
+                                              anAngle, aNbSteps, aTolerance);
+         else
+           aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
+                                              anAngle, aNbSteps, aTolerance);
+       }
+       else
+         aMeshEditor->RotationSweep(anElementsId.inout(), 
+                                    anAxis, 
+                                    anAngle, 
+                                    aNbSteps, 
+                                    aTolerance);
+       SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+       mySimulation->SetData(aMeshPreviewStruct._retn());
+      } catch (...) {}
+    }
+    else
+    {
+      mySimulation->SetVisibility(false);
+    }
+  }
+  else
+  {
+    //erase preview
+    mySimulation->SetVisibility(false);
+  }
+}
+
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool SMESHGUI_RevolutionDlg::isValid()
+{
+  QString msg;
+  bool ok = true;
+  ok = SpinBox_X->isValid( msg, true ) && ok;
+  ok = SpinBox_Y->isValid( msg, true ) && ok;
+  ok = SpinBox_Z->isValid( msg, true ) && ok;
+  ok = SpinBox_DX->isValid( msg, true ) && ok;
+  ok = SpinBox_DY->isValid( msg, true ) && ok;
+  ok = SpinBox_DZ->isValid( msg, true ) && ok;
+  ok = SpinBox_Angle->isValid( msg, true ) && ok;
+  ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
+  ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
+
+  if( !ok ) {
+    QString str( tr( "SMESH_INCORRECT_INPUT" ) );
+    if ( !msg.isEmpty() )
+      str += "\n" + msg;
+    SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
+    return false;
+  }
+  return true;
+}