+ if ( e->key() == Qt::Key_F1 ) {
+ e->accept();
+ ClickOnHelp();
+ }
+}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::setFilters()
+{
+ if(myMesh->_is_nil()) {
+ SUIT_MessageBox::critical(this,
+ tr("SMESH_ERROR"),
+ tr("NO_MESH_SELECTED"));
+ return;
+ }
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::NODE );
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ switch( GetConstructorId() ){
+ case 0:
+ {
+ myFilterDlg->Init( SMESH::NODE );
+ break;
+ }
+ case 1:
+ {
+ myFilterDlg->Init( SMESH::EDGE );
+ break;
+ }
+ case 2:
+ {
+ myFilterDlg->Init( SMESH::FACE );
+ break;
+ }
+ }
+
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool SMESHGUI_ExtrusionDlg::isValid()
+{
+ QString msg;
+ bool ok = true;
+ if ( RadioButton3->isChecked() ) {
+ ok = SpinBox_Dx->isValid( msg, true ) && ok;
+ ok = SpinBox_Dy->isValid( msg, true ) && ok;
+ ok = SpinBox_Dz->isValid( msg, true ) && ok;
+ } else if ( RadioButton4->isChecked() ) {
+ ok = SpinBox_Vx->isValid( msg, true ) && ok;
+ ok = SpinBox_Vy->isValid( msg, true ) && ok;
+ ok = SpinBox_Vz->isValid( msg, true ) && ok;
+ ok = SpinBox_VDist->isValid( msg, true ) && ok;
+ }
+ ok = SpinBox_NbSteps->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;
+}
+
+//=================================================================================
+// function : onDisplaySimulation
+// purpose : Show/Hide preview
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview ) {
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
+ if (myNbOkElements && isValid() && isValuesValid()) {
+ //Get input vector
+ SMESH::DirStruct aVector;
+ getExtrusionVector(aVector);
+
+ //Get Number of the steps
+ long aNbSteps = (long)SpinBox_NbSteps->value();
+
+ try {
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+ if( CheckBoxMesh->isChecked() ) {
+ switch (GetConstructorId()) {
+ case 0:
+ {
+ aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps);
+ break;
+ }
+ case 1:
+ {
+ aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
+ break;
+ }
+ case 2:
+ {
+ aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
+ break;
+ }
+ }
+ }
+ else
+ if(GetConstructorId() == 0)
+ aMeshEditor->ExtrusionSweep0D(myElementsId.inout(), aVector, aNbSteps);
+ else
+ aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+ mySimulation->SetData(aMeshPreviewStruct._retn());
+ } catch (...) {
+ hidePreview();
+ }
+ } else {
+ hidePreview();