1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_ExtrusionDlg.cxx
25 // Author : Michael ZORIN, Open CASCADE S.A.S.
28 #include "SMESHGUI_ExtrusionDlg.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34 #include "SMESHGUI_SpinBox.h"
35 #include "SMESHGUI_IdValidator.h"
36 #include "SMESHGUI_FilterDlg.h"
37 #include "SMESHGUI_MeshEditPreview.h"
39 #include <SMESH_Actor.h>
40 #include <SMESH_TypeFilter.hxx>
41 #include <SMESH_LogicalFilter.hxx>
43 #include <SMDS_Mesh.hxx>
45 // SALOME GUI includes
46 #include <SUIT_ResourceMgr.h>
47 #include <SUIT_Desktop.h>
48 #include <SUIT_MessageBox.h>
49 #include <SUIT_Session.h>
50 #include <SUIT_OverrideCursor.h>
52 #include <LightApp_Application.h>
53 #include <LightApp_SelectionMgr.h>
55 #include <SVTK_ViewModel.h>
56 #include <SVTK_ViewWindow.h>
58 #include <SalomeApp_IntSpinBox.h>
61 #include <TColStd_MapOfInteger.hxx>
62 #include <TColStd_IndexedMapOfInteger.hxx>
66 #include <QApplication>
67 #include <QButtonGroup>
71 #include <QPushButton>
72 #include <QRadioButton>
74 #include <QHBoxLayout>
75 #include <QVBoxLayout>
76 #include <QGridLayout>
80 #include <SALOMEconfig.h>
81 #include CORBA_SERVER_HEADER(SMESH_Group)
82 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
89 const char* getLabelText( int typeIndex, bool objSelection )
91 const char* typeLbl[3] = { "SMESH_ID_NODES", "SMESH_ID_EDGES", "SMESH_ID_FACES" };
92 const char* obj = "SMESH_OBJECTS";
93 return objSelection ? obj : typeLbl[ typeIndex ];
97 //================================================================================
101 //================================================================================
103 SMESHGUI_3TypesSelector::SMESHGUI_3TypesSelector( QWidget * parent ):
106 SMESHGUI* gui = SMESHGUI::GetSMESHGUI();
107 mySelectionMgr = SMESH::GetSelectionMgr( gui );
108 mySelector = SMESH::GetViewWindow( gui )->GetSelector();
110 myIdValidator = new SMESHGUI_IdValidator(this);
112 QPixmap image( SMESH::GetResourceMgr( gui )->loadPixmap("SMESH", tr("ICON_SELECT")));
114 mySelectBtnGrp = new QButtonGroup( this );
115 mySelectBtnGrp->setExclusive( true );
117 QVBoxLayout* mainLayout = new QVBoxLayout( this );
118 mainLayout->setSpacing( SPACING );
119 mainLayout->setMargin( 0 );
121 const char* groupLbl[3] = { "SMESH_NODES", "SMESH_EDGES", "SMESH_FACES" };
123 for ( int i = 0; i < 3; ++i )
125 myGroups[i] = new QGroupBox( tr( groupLbl[i] ), this );
126 mainLayout->addWidget( myGroups[i] );
127 QGridLayout* layout = new QGridLayout( myGroups[i] );
128 layout->setSpacing( SPACING );
129 layout->setMargin( MARGIN );
131 QPushButton* selBtn = new QPushButton( myGroups[i] );
132 selBtn->setIcon( image );
133 selBtn->setCheckable( true );
134 mySelectBtnGrp->addButton( selBtn, i );
135 myLabel [i] = new QLabel( myGroups[i] );
136 myLineEdit [i] = new QLineEdit( myGroups[i] );
137 myMeshChk [i] = new QCheckBox( tr("SMESH_SELECT_WHOLE_MESH"), myGroups[i] );
138 myFilterBtn[i] = new QPushButton( tr( "SMESH_BUT_FILTER" ), myGroups[i] );
140 myLineEdit[i]->setMaxLength(-1);
141 myLabel [i]->setText( tr( getLabelText( i, true )));
143 layout->addWidget(myLabel [i], 0, 0);
144 layout->addWidget(selBtn, 0, 1);
145 layout->addWidget(myLineEdit [i], 0, 2, 1, 2);
146 layout->addWidget(myFilterBtn[i], 0, 4);
147 layout->addWidget(myMeshChk [i], 1, 0, 1, 5);
148 layout->setColumnStretch( 2, 10 );
150 connect( myMeshChk [i], SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
151 connect( myFilterBtn[i], SIGNAL(clicked()), SLOT(setFilters()));
152 connect( myLineEdit [i], SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
153 myIDSource[i] = new SMESH::ListOfIDSources;
155 connect( mySelectBtnGrp, SIGNAL(buttonClicked (int)), SLOT(onSelectType(int)));
156 connect(mySelectionMgr, SIGNAL( currentSelectionChanged()), SLOT(selectionIntoArgument()));
158 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
159 QList<SUIT_SelectionFilter*> aListOfFilters;
160 aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH));
161 aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX));
162 aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE));
164 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
165 aListOfFilters.append(0);
166 aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
167 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
168 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
169 aListOfFilters[3] = new SMESH_TypeFilter (SMESH::IDSOURCE_EDGE); // for sub-mesh on group of EDGEs
171 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
172 aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
173 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
174 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
175 aListOfFilters[3] = new SMESH_TypeFilter (SMESH::IDSOURCE_FACE); // for sub-mesh on group of FACEs
177 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
181 myMeshChk[0]->setChecked( true );
182 myMeshChk[1]->setChecked( true );
183 myMeshChk[2]->setChecked( true );
184 mySelectBtnGrp->button(0)->click();
187 //================================================================================
191 //================================================================================
193 SMESHGUI_3TypesSelector::~SMESHGUI_3TypesSelector()
205 myFilterDlg->setParent( 0 );
209 disconnect(mySelectionMgr, 0, this, 0);
212 //================================================================================
214 * \brief Slot called when selection changes
216 //================================================================================
218 void SMESHGUI_3TypesSelector::selectionIntoArgument()
222 // return if dialog box is inactive
226 // get a current element type
227 int iType = mySelectBtnGrp->checkedId();
228 if ( iType < 0 || iType > 2 )
231 QString aString = "";
236 myLineEdit[ iType ]->setText(aString);
237 myIDSource[ iType ]->length (nbObjects);
239 if ( !myGroups[ iType ]->isEnabled() )
242 SMESH::SetPointRepresentation(false);
244 SALOME_ListIO selected;
245 mySelectionMgr->selectedObjects( selected );
247 if ( myMeshChk[ iType ]->isChecked() ) // objects selection
248 myIDSource[ iType ]->length( selected.Extent() ); // reserve
249 myIDSource[ iType ]->length(0);
251 SALOME_ListIteratorOfListIO It( selected );
252 for ( ; It.More(); It.Next() )
254 Handle(SALOME_InteractiveObject) IO = It.Value();
257 SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO);
258 if ( mesh->_is_nil() )
260 if ( !myMesh->_is_nil() &&
261 IsAnythingSelected() &&
262 myMesh->GetId() != mesh->GetId() )
263 continue; // other mesh
266 myActor = SMESH::FindActorByEntry( IO->getEntry() );
268 if ( myMeshChk[ iType ]->isChecked() ) // objects selection
270 SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
271 if ( idSrc->_is_nil() )
273 mesh = SMESH::SMESH_Mesh::_narrow( idSrc );
274 if ( !mesh->_is_nil() ) // if a mesh is selected, stop iteration
277 myIDSource[ iType ]->length( nbObjects );
278 myIDSource[ iType ][ 0 ] = idSrc;
279 aString = IO->getName();
282 else // several groups can be selected
284 myIDSource[ iType ]->length( nbObjects + 1 );
285 myIDSource[ iType ][ nbObjects++ ] = idSrc;
286 aString += " " + QString( IO->getName() ) + " ";
289 else // get indices of selected elements
291 TColStd_IndexedMapOfInteger aMapIndex;
292 mySelector->GetIndex(IO,aMapIndex);
293 int nbElements = aMapIndex.Extent();
294 if ( nbElements > 0 )
296 SMESH::long_array_var ids = new SMESH::long_array;
297 ids->length( nbElements );
298 for ( int i = 0; i < nbElements; ++i )
299 aString += QString(" %1").arg( ids[ i ] = aMapIndex( i+1 ));
300 addTmpIdSource( ids, iType, nbObjects++ );
306 myIDSource[ iType ]->length( nbObjects );
309 myLineEdit[ iType ]->setText(aString);
312 emit selectionChanged();
315 //================================================================================
317 * \brief Slot called when text changes in myLineEdit
319 //================================================================================
321 void SMESHGUI_3TypesSelector::onTextChange( const QString& theNewText )
326 // get a current element type
328 QLineEdit* le = (QLineEdit*) sender();
329 for ( ; iType < 3; ++iType )
330 if ( myLineEdit[ iType ] == le )
332 if ( iType < 0 || iType > 2 )
334 if ( !myGroups[ iType ]->isEnabled() )
339 // hilight entered elements/nodes
341 myIDSource[ iType ]->length( 0 );
343 if ( !myMesh->_is_nil() )
345 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
346 if ( aListId.count() > 0 )
348 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
350 SMESH::ElementType SMESHType = SMESH::ElementType ( iType+1 );
351 SMDSAbs_ElementType SMDSType = SMDSAbs_ElementType( iType+1 );
352 const bool isNode = ( SMDSType == SMDSAbs_Node );
354 SMESH::long_array_var ids = new SMESH::long_array;
355 ids->length( aListId.count() );
356 TColStd_MapOfInteger newIndices;
357 for (int i = 0; i < aListId.count(); i++) {
358 int id = aListId[ i ].toInt();
359 bool validId = false;
362 const SMDS_MeshElement * e;
363 if ( isNode ) e = aMesh->FindNode( id );
364 else e = aMesh->FindElement( id );
365 validId = ( e && e->GetType() == SMDSType );
367 validId = ( myMesh->GetElementType( id, !isNode ) == SMESHType );
370 if ( validId && newIndices.Add( id ))
371 ids[ newIndices.Extent()-1 ] = id;
373 if ( !newIndices.IsEmpty() ) {
374 ids->length( newIndices.Extent() );
375 addTmpIdSource( ids, iType, 0 );
377 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
378 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
379 aViewWindow->highlight( myIO, true, true );
383 emit selectionChanged();
388 //================================================================================
390 * \brief Creates from ids and stores a temporary IDSource
392 //================================================================================
394 void SMESHGUI_3TypesSelector::addTmpIdSource( SMESH::long_array_var& ids, int iType, int index )
396 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
397 SMESH::SMESH_IDSource_var idSrc =
398 aMeshEditor->MakeIDSource( ids, SMESH::ElementType( iType+1 ));
400 if ( myIDSource[ iType ]->length() <= index )
401 myIDSource[ iType ]->length( index + 1 );
402 myIDSource[ iType ][ index ] = idSrc;
404 myTmpIDSourceList.push_back( idSrc );
407 //================================================================================
409 * \brief Slot called when myMeshChk is checked
411 //================================================================================
413 void SMESHGUI_3TypesSelector::onSelectMesh( bool on )
415 QCheckBox* send = (QCheckBox*)sender();
416 for ( int iType = 0; iType < 3; ++iType )
417 if ( send == myMeshChk[ iType ])
419 myLabel[ iType ]->setText( tr( getLabelText( iType, on )));
420 myFilterBtn[ iType ]->setEnabled( !on );
421 myIDSource [ iType ]->length(0);
423 myLineEdit [ iType ]->setText("");
425 myLineEdit [ iType ]->setReadOnly( on );
426 myLineEdit [ iType ]->setValidator( on ? 0 : myIdValidator );
427 mySelectBtnGrp->button(iType)->click();
436 //================================================================================
438 * \brief Slot called when a selection button is clicked
440 //================================================================================
442 void SMESHGUI_3TypesSelector::onSelectType(int iType)
444 if ( iType < 0 || iType > 2 )
447 myIDSource[ iType ]->length(0);
448 myLineEdit[ iType ]->setText("");
450 disconnect(mySelectionMgr, 0, this, 0);
451 mySelectionMgr->clearFilters();
453 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
454 if ( myMeshChk[ iType ]->isChecked() )
456 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
457 mySelectionMgr->installFilter( myFilter[ iType ]);
459 else if ( aViewWindow )
462 case SMESH::NODE: aViewWindow->SetSelectionMode(NodeSelection); break;
463 case SMESH::EDGE: aViewWindow->SetSelectionMode(EdgeSelection); break;
464 case SMESH::FACE: aViewWindow->SetSelectionMode(FaceSelection); break;
468 myLineEdit[ iType ]->setFocus();
470 connect(mySelectionMgr, SIGNAL( currentSelectionChanged()), SLOT( selectionIntoArgument()));
471 selectionIntoArgument();
474 //================================================================================
476 * \brief Slot called when "Set filter" is clicked
478 //================================================================================
480 void SMESHGUI_3TypesSelector::setFilters()
482 if ( myMesh->_is_nil() ) {
483 SUIT_MessageBox::critical(this,
485 tr("NO_MESH_SELECTED"));
491 types.append( SMESH::NODE );
492 types.append( SMESH::EDGE );
493 types.append( SMESH::FACE );
494 myFilterDlg = new SMESHGUI_FilterDlg( SMESHGUI::GetSMESHGUI(), types );
497 QPushButton* send = (QPushButton*)sender();
498 for ( int iType = 0; iType < 3; ++iType )
499 if ( send == myFilterBtn[ iType ])
501 mySelectBtnGrp->button(iType)->click();
503 myFilterDlg->Init( SMESH::ElementType( iType+1 ) );
504 myFilterDlg->SetSelection();
505 myFilterDlg->SetMesh( myMesh );
506 myFilterDlg->SetSourceWg( myLineEdit[ iType ]);
512 //================================================================================
514 * \brief Clear selection
516 //================================================================================
518 void SMESHGUI_3TypesSelector::Clear()
521 for ( int iType = 0; iType < 3; ++iType )
523 myIDSource[ iType ]->length(0);
524 myLineEdit[ iType ]->setText("");
527 selectionIntoArgument();
530 //================================================================================
532 * \brief Enable/disable controls of a type
534 //================================================================================
536 void SMESHGUI_3TypesSelector::SetEnabled( bool enable, SMESH::ElementType type )
539 for ( int iType = 0; iType < 3; ++iType )
540 if ( iType+1 == type || type == SMESH::ALL )
542 myGroups[ iType ]->setEnabled( enable );
544 myIDSource[ iType ]->length(0);
545 myLineEdit[ iType ]->setText("");
549 selectionIntoArgument();
552 //================================================================================
554 * \brief Checks if anything is selected
556 //================================================================================
558 bool SMESHGUI_3TypesSelector::IsAnythingSelected( SMESH::ElementType type )
562 for ( int iType = 0; iType < 3; ++iType )
563 if ( iType+1 == type || type == SMESH::ALL )
564 nbSel += myIDSource[ iType ]->length();
569 //================================================================================
571 * \brief Returns selected elements and most complex type of selected elements
573 //================================================================================
575 SMESH::ElementType SMESHGUI_3TypesSelector::GetSelected( SMESH::ListOfIDSources & nodes,
576 SMESH::ListOfIDSources & edges,
577 SMESH::ListOfIDSources & faces )
579 nodes = myIDSource[0];
580 edges = myIDSource[1];
581 faces = myIDSource[2];
583 if ( myIDSource[2]->length() > 0 ) return SMESH::FACE;
584 if ( myIDSource[1]->length() > 0 ) return SMESH::EDGE;
585 if ( myIDSource[0]->length() > 0 ) return SMESH::NODE;
589 //=================================================================================
590 // function : SMESHGUI_ExtrusionDlg()
591 // purpose : constructor
592 //=================================================================================
594 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
595 : SMESHGUI_PreviewDlg( theModule ),
596 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
598 QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
601 setAttribute( Qt::WA_DeleteOnClose, true );
602 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
603 setSizeGripEnabled(true);
605 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
606 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
607 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
609 /***************************************************************/
610 GroupArguments = new QGroupBox(tr("SMESH_EXTRUSION"), this);
611 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
612 GroupArgumentsLayout->setSpacing(SPACING);
613 GroupArgumentsLayout->setMargin(MARGIN);
615 // Controls for elements selection
616 SelectorWdg = new SMESHGUI_3TypesSelector( GroupArguments );
618 ExtrMethod_RBut0 = new QRadioButton(GroupArguments);
619 ExtrMethod_RBut0->setText( tr("SMESH_EXTRUSION_TO_DISTANCE") );
620 ExtrMethod_RBut1 = new QRadioButton(GroupArguments);
621 ExtrMethod_RBut1->setText( tr("SMESH_EXTRUSION_ALONG_VECTOR") );
622 ExtrMethod_RBut2 = new QRadioButton(GroupArguments);
623 ExtrMethod_RBut2->setText( tr("SMESH_EXTRUSION_BY_NORMAL") );
625 //Control for the Distance selection
626 TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
628 TextLabelDx = new QLabel(tr("SMESH_X"), GroupArguments);
629 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
631 TextLabelDy = new QLabel(tr("SMESH_Y"), GroupArguments);
632 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
634 TextLabelDz = new QLabel(tr("SMESH_Z"), GroupArguments);
635 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
637 // Controls for vector selection
639 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
641 SelectVectorButton = new QPushButton(GroupArguments);
642 SelectVectorButton->setIcon(image);
643 SelectVectorButton->setCheckable( true );
644 SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
646 TextLabelVx = new QLabel(tr("SMESH_DX"), GroupArguments);
647 SpinBox_Vx = new SMESHGUI_SpinBox(GroupArguments);
649 TextLabelVy = new QLabel(tr("SMESH_DY"), GroupArguments);
650 SpinBox_Vy = new SMESHGUI_SpinBox(GroupArguments);
652 TextLabelVz = new QLabel(tr("SMESH_DZ"), GroupArguments);
653 SpinBox_Vz = new SMESHGUI_SpinBox(GroupArguments);
655 TextLabelDist = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
656 SpinBox_VDist = new SMESHGUI_SpinBox(GroupArguments);
658 // Controls for nb. steps defining
659 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
660 SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupArguments);
662 // CheckBox for groups generation
663 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
665 // CheckBox for ByAverageNormal arg of ExtrusionByNormal()
666 ByAverageNormalCheck = new QCheckBox(tr("BY_AVERAGE_NORMAL"), GroupArguments);
668 // CheckBox for UseInputElemsOnly arg of ExtrusionByNormal()
669 UseInputElemsOnlyCheck = new QCheckBox(tr("USE_INPUT_ELEMS_ONLY"), GroupArguments);
672 myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
674 GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 9);
675 GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 1, 0, 1, 3);
676 GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 1, 3, 1, 3);
677 GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 1, 6, 1, 3);
678 GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0);
679 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
680 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
681 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
682 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
683 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
684 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
685 GroupArgumentsLayout->addWidget(TextLabelVector, 3, 0);
686 GroupArgumentsLayout->addWidget(SelectVectorButton, 3, 1);
687 GroupArgumentsLayout->addWidget(TextLabelVx, 3, 2);
688 GroupArgumentsLayout->addWidget(SpinBox_Vx, 3, 3);
689 GroupArgumentsLayout->addWidget(TextLabelVy, 3, 4);
690 GroupArgumentsLayout->addWidget(SpinBox_Vy, 3, 5);
691 GroupArgumentsLayout->addWidget(TextLabelVz, 3, 6);
692 GroupArgumentsLayout->addWidget(SpinBox_Vz, 3, 7);
693 GroupArgumentsLayout->addWidget(TextLabelDist, 4, 0);
694 GroupArgumentsLayout->addWidget(SpinBox_VDist, 4, 3);
695 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 5, 0, 1, 3);
696 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 5, 3);
697 GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 6, 0, 1, 4);
698 GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 6, 4, 1, 4);
699 GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0, 1, 8);
700 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 8, 0, 1, 8);
701 GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0);
703 /***************************************************************/
704 GroupButtons = new QGroupBox(this);
705 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
706 GroupButtonsLayout->setSpacing(SPACING);
707 GroupButtonsLayout->setMargin(MARGIN);
709 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
710 buttonOk->setAutoDefault(true);
711 buttonOk->setDefault(true);
712 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
713 buttonApply->setAutoDefault(true);
714 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
715 buttonCancel->setAutoDefault(true);
716 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
717 buttonHelp->setAutoDefault(true);
719 GroupButtonsLayout->addWidget(buttonOk);
720 GroupButtonsLayout->addSpacing(10);
721 GroupButtonsLayout->addWidget(buttonApply);
722 GroupButtonsLayout->addSpacing(10);
723 GroupButtonsLayout->addStretch();
724 GroupButtonsLayout->addWidget(buttonCancel);
725 GroupButtonsLayout->addWidget(buttonHelp);
727 /***************************************************************/
728 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
729 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
731 /* Initialisations */
732 SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
733 SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
734 SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
736 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
737 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
738 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
740 SpinBox_NbSteps->setRange(1, 999999);
741 SpinBox_VDist->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
743 ExtrMethod_RBut0->setChecked(true);
744 UseInputElemsOnlyCheck->setChecked(true);
745 MakeGroupsCheck->setChecked(true);
747 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
749 mySMESHGUI->SetActiveDialogBox(this);
751 myHelpFileName = "extrusion_page.html";
755 /***************************************************************/
756 // signals and slots connections
757 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
758 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
759 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
760 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
762 connect(ExtrMethod_RBut0, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
763 connect(ExtrMethod_RBut1, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
764 connect(ExtrMethod_RBut2, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
766 // to update state of the Ok & Apply buttons
767 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
768 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
769 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
770 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
771 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
772 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
774 connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
775 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
776 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(toDisplaySimulation()));
777 connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(toDisplaySimulation()));
778 connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(CheckIsEnable()));
779 /* to close dialog if study change */
780 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
782 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
783 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
784 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
785 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
786 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
787 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
788 connect(SpinBox_VDist, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
789 connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
790 connect(ByAverageNormalCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
791 connect(UseInputElemsOnlyCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
793 //To Connect preview check box
794 connectPreviewControl();
796 /***************************************************************/
801 //=================================================================================
802 // function : ~SMESHGUI_ExtrusionDlg()
803 // purpose : destructor
804 //=================================================================================
805 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
809 //=================================================================================
811 // purpose : initialization
812 //=================================================================================
813 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
817 SpinBox_NbSteps->setValue(1);
818 SpinBox_VDist->setValue(10);
819 SpinBox_Dx->SetValue(0);
820 SpinBox_Dy->SetValue(0);
821 SpinBox_Dz->SetValue(0);
822 SpinBox_Vx->SetValue(0);
823 SpinBox_Vy->SetValue(0);
824 SpinBox_Vz->SetValue(0);
826 myPreviewCheckBox->setChecked(false);
827 onDisplaySimulation(false);
829 SelectorWdg->Clear();
833 //=================================================================================
834 // function : CheckIsEnable()
835 // purpose : Check whether the Ok and Apply buttons should be enabled or not
836 //=================================================================================
837 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
839 bool anIsEnable = SelectorWdg->IsAnythingSelected() && isValuesValid();
841 buttonOk->setEnabled(anIsEnable);
842 buttonApply->setEnabled(anIsEnable);
845 //=================================================================================
846 // function : isValuesValid()
847 // purpose : Return true in case if values entered into dialog are valid
848 //=================================================================================
849 bool SMESHGUI_ExtrusionDlg::isValuesValid()
851 double aX, aY, aZ, aModule = 0;
852 if ( ExtrMethod_RBut0->isChecked() )
854 aX = SpinBox_Dx->GetValue();
855 aY = SpinBox_Dy->GetValue();
856 aZ = SpinBox_Dz->GetValue();
857 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
859 else if ( ExtrMethod_RBut1->isChecked() )
861 aX = SpinBox_Vx->GetValue();
862 aY = SpinBox_Vy->GetValue();
863 aZ = SpinBox_Vz->GetValue();
864 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
865 double aVDist = (double)SpinBox_VDist->value();
868 else if ( ExtrMethod_RBut2->isChecked() )
870 aModule = Abs((double)SpinBox_VDist->value());
873 return aModule > 1.0E-38;
876 //=================================================================================
877 // function : ClickOnRadio()
878 // purpose : Radio button management
879 //=================================================================================
881 void SMESHGUI_ExtrusionDlg::ClickOnRadio()
883 if ( ExtrMethod_RBut0->isChecked() )
885 TextLabelDistance->show();
893 TextLabelVector->hide();
900 TextLabelDist->hide();
901 SpinBox_VDist->hide();
902 SelectVectorButton->hide();
904 ByAverageNormalCheck->hide();
905 UseInputElemsOnlyCheck->hide();
907 SelectorWdg->SetEnabled( true, SMESH::ALL );
909 else if ( ExtrMethod_RBut1->isChecked() )
911 TextLabelDistance->hide();
919 TextLabelVector->show();
926 TextLabelDist->show();
927 SpinBox_VDist->show();
928 SelectVectorButton->show();
930 ByAverageNormalCheck->hide();
931 UseInputElemsOnlyCheck->hide();
933 SelectorWdg->SetEnabled( true, SMESH::ALL );
935 else if ( ExtrMethod_RBut2->isChecked() )
937 TextLabelDistance->hide();
945 TextLabelVector->hide();
953 TextLabelDist->show();
954 SpinBox_VDist->show();
955 SelectVectorButton->hide();
957 ByAverageNormalCheck->show();
958 UseInputElemsOnlyCheck->show();
960 SelectorWdg->SetEnabled( false, SMESH::NODE );
961 SelectorWdg->SetEnabled( false, SMESH::EDGE );
966 onDisplaySimulation(true);
968 qApp->processEvents();
970 resize( minimumSizeHint() );
973 //=================================================================================
974 // function : ClickOnApply()
975 // purpose : Called when user presses <Apply> button
976 //=================================================================================
978 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
980 if (mySMESHGUI->isActiveStudyLocked())
986 if ( SelectorWdg->IsAnythingSelected() )
988 SMESH::DirStruct aVector;
989 getExtrusionVector(aVector);
991 QStringList aParameters;
992 if ( ExtrMethod_RBut0->isChecked() )
994 aParameters << SpinBox_Dx->text();
995 aParameters << SpinBox_Dy->text();
996 aParameters << SpinBox_Dz->text();
998 else if ( ExtrMethod_RBut1->isChecked() )
1000 // only 3 coords in a python dump command :(
1001 // aParameters << SpinBox_Vx->text();
1002 // aParameters << SpinBox_Vy->text();
1003 // aParameters << SpinBox_Vz->text();
1004 // aParameters << SpinBox_VDist->text();
1006 else if ( ExtrMethod_RBut2->isChecked() )
1008 aParameters << SpinBox_VDist->text();
1011 long aNbSteps = (long)SpinBox_NbSteps->value();
1013 aParameters << SpinBox_NbSteps->text();
1015 bool meshHadNewTypeBefore = true;
1017 const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
1020 SUIT_OverrideCursor aWaitCursor;
1022 SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
1024 SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
1025 SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
1026 SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
1027 maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
1029 // is it necessary to switch on the next Display Mode?
1030 SMESH::ElementType newType = (SMESH::ElementType)( maxSelType + 1 );
1031 SMESH::array_of_ElementType_var oldTypes = mesh->GetTypes();
1032 meshHadNewTypeBefore = false;
1033 for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i )
1034 meshHadNewTypeBefore = ( oldTypes[i] >= newType );
1036 SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditor();
1037 SMESH::ListOfGroups_var groups;
1039 mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
1041 if ( ExtrMethod_RBut2->isVisible() &&
1042 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
1044 double stepSize = (double) SpinBox_VDist->value();
1045 long nbSteps = (long) SpinBox_NbSteps->value();
1046 bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
1047 bool byAverageNormal = ByAverageNormalCheck->isChecked();
1048 int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
1050 groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
1051 byAverageNormal, makeGroups, dim );
1055 groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
1056 aVector, aNbSteps, makeGroups );
1062 SMESH_Actor* actor = SelectorWdg->GetActor();
1063 if ( actor && !meshHadNewTypeBefore )
1065 unsigned int aMode = actor->GetEntityMode();
1066 switch ( maxSelType ) {
1067 case SMESH::NODE: // extrude node -> edges
1068 actor->SetRepresentation(SMESH_Actor::eEdge);
1069 actor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
1070 case SMESH::EDGE: // edge -> faces
1071 actor->SetRepresentation(SMESH_Actor::eSurface);
1072 actor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
1073 case SMESH::FACE: // faces -> volumes
1074 actor->SetRepresentation(SMESH_Actor::eSurface);
1075 actor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
1079 SMESH::Update( actor->getIO(), actor->GetVisibility() );
1081 mySMESHGUI->updateObjBrowser(true); // new groups may appear
1083 mySelectionMgr->clearSelected();
1084 SelectorWdg->Clear();
1086 SMESHGUI::Modified();
1091 //=================================================================================
1092 // function : ClickOnOk()
1093 // purpose : Called when user presses <OK> button
1094 //=================================================================================
1095 void SMESHGUI_ExtrusionDlg::ClickOnOk()
1101 //=================================================================================
1102 // function : reject()
1103 // purpose : Called when dialog box is closed
1104 //=================================================================================
1105 void SMESHGUI_ExtrusionDlg::reject()
1107 disconnect(mySelectionMgr, 0, this, 0);
1108 mySelectionMgr->clearFilters();
1109 //mySelectionMgr->clearSelected();
1110 if (SMESH::GetCurrentVtkView()) {
1111 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
1112 SMESH::SetPointRepresentation(false);
1113 SMESH::SetPickable();
1115 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1116 aViewWindow->SetSelectionMode(ActorSelection);
1117 mySMESHGUI->ResetState();
1122 //=================================================================================
1123 // function : ClickOnHelp()
1125 //=================================================================================
1126 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
1128 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
1130 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
1134 platform = "winapplication";
1136 platform = "application";
1138 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
1139 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
1140 arg(app->resourceMgr()->stringValue("ExternalBrowser",
1142 arg(myHelpFileName));
1146 //=================================================================================
1147 // function : SelectionIntoArgument()
1148 // purpose : Called when selection has changed or other case
1149 //=================================================================================
1150 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
1152 // return if dialog box is inactive
1153 if (!GroupButtons->isEnabled())
1156 if ( SelectVectorButton->isChecked() )
1158 SALOME_ListIO aList;
1159 mySelectionMgr->selectedObjects(aList);
1160 if ( aList.IsEmpty() || aList.Extent() > 1 )
1163 Handle(SALOME_InteractiveObject) IO = aList.First();
1164 TColStd_IndexedMapOfInteger aMapIndex;
1165 mySelector->GetIndex(IO,aMapIndex);
1166 if ( aMapIndex.Extent() != 1 )
1168 SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
1169 SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
1173 const SMDS_MeshFace* face =
1174 dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
1178 gp_XYZ aNormale = SMESH::getNormale(face);
1179 SpinBox_Vx->SetValue(aNormale.X());
1180 SpinBox_Vy->SetValue(aNormale.Y());
1181 SpinBox_Vz->SetValue(aNormale.Z());
1184 onDisplaySimulation(true);
1188 //=================================================================================
1189 // function : SetEditCurrentArgument()
1191 //=================================================================================
1192 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
1194 QPushButton* send = (QPushButton*)sender();
1196 disconnect(mySelectionMgr, 0, this, 0);
1197 mySelectionMgr->clearSelected();
1198 mySelectionMgr->clearFilters();
1200 if (send == SelectVectorButton)
1202 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1203 aViewWindow->SetSelectionMode(FaceSelection);
1206 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1207 SelectionIntoArgument();
1210 //=================================================================================
1211 // function : DeactivateActiveDialog()
1212 // purpose : Deactivates this dialog
1213 //=================================================================================
1214 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
1216 if (GroupButtons->isEnabled())
1218 GroupArguments->setEnabled(false);
1219 GroupButtons->setEnabled(false);
1220 SelectorWdg->setEnabled(false);
1221 mySMESHGUI->ResetState();
1222 mySMESHGUI->SetActiveDialogBox(0);
1226 //=================================================================================
1227 // function : ActivateThisDialog()
1228 // purpose : Activates this dialog
1229 //=================================================================================
1230 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
1232 // Emit a signal to deactivate the active dialog
1233 mySMESHGUI->EmitSignalDeactivateDialog();
1234 GroupArguments->setEnabled(true);
1235 GroupButtons->setEnabled(true);
1236 SelectorWdg->setEnabled(true);
1238 mySMESHGUI->SetActiveDialogBox(this);
1241 //=================================================================================
1242 // function : enterEvent()
1243 // purpose : Mouse enter event
1244 //=================================================================================
1245 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
1247 if (!GroupButtons->isEnabled())
1248 ActivateThisDialog();
1251 //=================================================================================
1252 // function : keyPressEvent()
1254 //=================================================================================
1255 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
1257 QDialog::keyPressEvent( e );
1258 if ( e->isAccepted() )
1261 if ( e->key() == Qt::Key_F1 ) {
1267 //=================================================================================
1268 // function : isValid
1270 //=================================================================================
1271 bool SMESHGUI_ExtrusionDlg::isValid()
1275 if ( ExtrMethod_RBut0->isChecked() ) {
1276 ok = SpinBox_Dx->isValid( msg, true ) && ok;
1277 ok = SpinBox_Dy->isValid( msg, true ) && ok;
1278 ok = SpinBox_Dz->isValid( msg, true ) && ok;
1279 } else if ( ExtrMethod_RBut1->isChecked() ) {
1280 ok = SpinBox_Vx->isValid( msg, true ) && ok;
1281 ok = SpinBox_Vy->isValid( msg, true ) && ok;
1282 ok = SpinBox_Vz->isValid( msg, true ) && ok;
1283 ok = SpinBox_VDist->isValid( msg, true ) && ok;
1285 ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
1288 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1289 if ( !msg.isEmpty() )
1291 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1297 //=================================================================================
1298 // function : onDisplaySimulation
1299 // purpose : Show/Hide preview
1300 //=================================================================================
1301 void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
1303 if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1304 if ( SelectorWdg->IsAnythingSelected() && isValid() && isValuesValid())
1307 SMESH::DirStruct aVector;
1308 getExtrusionVector(aVector);
1310 //Get Number of the steps
1311 long aNbSteps = (long)SpinBox_NbSteps->value();
1314 SUIT_OverrideCursor aWaitCursor;
1316 SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
1317 SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditPreviewer();
1318 SMESH::ListOfGroups_var groups;
1320 SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
1321 SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
1322 SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
1323 const int maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
1324 const bool makeGroups = false;
1326 if ( ExtrMethod_RBut2->isVisible() &&
1327 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
1329 double stepSize = (double) SpinBox_VDist->value();
1330 long nbSteps = (long) SpinBox_NbSteps->value();
1331 bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
1332 bool byAverageNormal = ByAverageNormalCheck->isChecked();
1333 int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
1335 groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
1336 byAverageNormal, makeGroups, dim );
1340 groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
1341 aVector, aNbSteps, makeGroups );
1343 SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
1344 mySimulation->SetData(aMeshPreviewStruct._retn());
1357 //=================================================================================
1358 // function : getExtrusionVector()
1359 // purpose : get direction of the extrusion
1360 //=================================================================================
1361 void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector)
1363 if ( ExtrMethod_RBut0->isChecked() )
1365 aVector.PS.x = SpinBox_Dx->GetValue();
1366 aVector.PS.y = SpinBox_Dy->GetValue();
1367 aVector.PS.z = SpinBox_Dz->GetValue();
1369 else if ( ExtrMethod_RBut1->isChecked() )
1371 gp_XYZ aNormale(SpinBox_Vx->GetValue(),
1372 SpinBox_Vy->GetValue(),
1373 SpinBox_Vz->GetValue());
1374 aNormale /= aNormale.Modulus();
1375 double aVDist = (double)SpinBox_VDist->value();
1377 aVector.PS.x = aNormale.X()*aVDist;
1378 aVector.PS.y = aNormale.Y()*aVDist;
1379 aVector.PS.z = aNormale.Z()*aVDist;