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[0] = new SMESH_TypeFilter (SMESH::MESH);
166 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
167 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
169 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
170 aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
171 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
172 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
174 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
178 myMeshChk[0]->setChecked( true );
179 myMeshChk[1]->setChecked( true );
180 myMeshChk[2]->setChecked( true );
181 mySelectBtnGrp->button(0)->click();
184 //================================================================================
188 //================================================================================
190 SMESHGUI_3TypesSelector::~SMESHGUI_3TypesSelector()
202 myFilterDlg->setParent( 0 );
206 disconnect(mySelectionMgr, 0, this, 0);
209 //================================================================================
211 * \brief Slot called when selection changes
213 //================================================================================
215 void SMESHGUI_3TypesSelector::selectionIntoArgument()
219 // return if dialog box is inactive
223 // get a current element type
224 int iType = mySelectBtnGrp->checkedId();
225 if ( iType < 0 || iType > 2 )
228 QString aString = "";
233 myLineEdit[ iType ]->setText(aString);
234 myIDSource[ iType ]->length (nbObjects);
236 if ( !myGroups[ iType ]->isEnabled() )
239 SMESH::SetPointRepresentation(false);
241 SALOME_ListIO selected;
242 mySelectionMgr->selectedObjects( selected );
244 if ( myMeshChk[ iType ]->isChecked() ) // objects selection
245 myIDSource[ iType ]->length( selected.Extent() ); // reserve
246 myIDSource[ iType ]->length(0);
248 SALOME_ListIteratorOfListIO It( selected );
249 for ( ; It.More(); It.Next() )
251 Handle(SALOME_InteractiveObject) IO = It.Value();
254 SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO);
255 if ( mesh->_is_nil() )
257 if ( !myMesh->_is_nil() &&
258 IsAnythingSelected() &&
259 myMesh->GetId() != mesh->GetId() )
260 continue; // other mesh
263 myActor = SMESH::FindActorByEntry( IO->getEntry() );
265 if ( myMeshChk[ iType ]->isChecked() ) // objects selection
267 SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
268 if ( idSrc->_is_nil() )
270 mesh = SMESH::SMESH_Mesh::_narrow( idSrc );
271 if ( !mesh->_is_nil() ) // if a mesh is selected, stop iteration
274 myIDSource[ iType ]->length( nbObjects );
275 myIDSource[ iType ][ 0 ] = idSrc;
276 aString = IO->getName();
279 else // several groups can be selected
281 myIDSource[ iType ]->length( nbObjects + 1 );
282 myIDSource[ iType ][ nbObjects++ ] = idSrc;
283 aString += " " + QString( IO->getName() ) + " ";
286 else // get indices of selected elements
288 TColStd_IndexedMapOfInteger aMapIndex;
289 mySelector->GetIndex(IO,aMapIndex);
290 int nbElements = aMapIndex.Extent();
291 if ( nbElements > 0 )
293 SMESH::long_array_var ids = new SMESH::long_array;
294 ids->length( nbElements );
295 for ( int i = 0; i < nbElements; ++i )
296 aString += QString(" %1").arg( ids[ i ] = aMapIndex( i+1 ));
297 addTmpIdSource( ids, iType, nbObjects++ );
303 myIDSource[ iType ]->length( nbObjects );
306 myLineEdit[ iType ]->setText(aString);
309 emit selectionChanged();
312 //================================================================================
314 * \brief Slot called when text changes in myLineEdit
316 //================================================================================
318 void SMESHGUI_3TypesSelector::onTextChange( const QString& theNewText )
323 // get a current element type
325 QLineEdit* le = (QLineEdit*) sender();
326 for ( ; iType < 3; ++iType )
327 if ( myLineEdit[ iType ] == le )
329 if ( iType < 0 || iType > 2 )
331 if ( !myGroups[ iType ]->isEnabled() )
336 // hilight entered elements/nodes
338 myIDSource[ iType ]->length( 0 );
340 if ( !myMesh->_is_nil() )
342 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
343 if ( aListId.count() > 0 )
345 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
347 SMESH::ElementType SMESHType = SMESH::ElementType ( iType+1 );
348 SMDSAbs_ElementType SMDSType = SMDSAbs_ElementType( iType+1 );
349 const bool isNode = ( SMDSType == SMDSAbs_Node );
351 SMESH::long_array_var ids = new SMESH::long_array;
352 ids->length( aListId.count() );
353 TColStd_MapOfInteger newIndices;
354 for (int i = 0; i < aListId.count(); i++) {
355 int id = aListId[ i ].toInt();
356 bool validId = false;
359 const SMDS_MeshElement * e;
360 if ( isNode ) e = aMesh->FindNode( id );
361 else e = aMesh->FindElement( id );
362 validId = ( e && e->GetType() == SMDSType );
364 validId = ( myMesh->GetElementType( id, !isNode ) == SMESHType );
367 if ( validId && newIndices.Add( id ))
368 ids[ newIndices.Extent()-1 ] = id;
370 if ( !newIndices.IsEmpty() ) {
371 ids->length( newIndices.Extent() );
372 addTmpIdSource( ids, iType, 0 );
374 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
375 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
376 aViewWindow->highlight( myIO, true, true );
380 emit selectionChanged();
385 //================================================================================
387 * \brief Creates from ids and stores a temporary IDSource
389 //================================================================================
391 void SMESHGUI_3TypesSelector::addTmpIdSource( SMESH::long_array_var& ids, int iType, int index )
393 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
394 SMESH::SMESH_IDSource_var idSrc =
395 aMeshEditor->MakeIDSource( ids, SMESH::ElementType( iType+1 ));
397 if ( myIDSource[ iType ]->length() <= index )
398 myIDSource[ iType ]->length( index + 1 );
399 myIDSource[ iType ][ index ] = idSrc;
401 myTmpIDSourceList.push_back( idSrc );
404 //================================================================================
406 * \brief Slot called when myMeshChk is checked
408 //================================================================================
410 void SMESHGUI_3TypesSelector::onSelectMesh( bool on )
412 QCheckBox* send = (QCheckBox*)sender();
413 for ( int iType = 0; iType < 3; ++iType )
414 if ( send == myMeshChk[ iType ])
416 myLabel[ iType ]->setText( tr( getLabelText( iType, on )));
417 myFilterBtn[ iType ]->setEnabled( !on );
418 myIDSource [ iType ]->length(0);
420 myLineEdit [ iType ]->setText("");
422 myLineEdit [ iType ]->setReadOnly( on );
423 myLineEdit [ iType ]->setValidator( on ? 0 : myIdValidator );
424 mySelectBtnGrp->button(iType)->click();
433 //================================================================================
435 * \brief Slot called when a selection button is clicked
437 //================================================================================
439 void SMESHGUI_3TypesSelector::onSelectType(int iType)
441 if ( iType < 0 || iType > 2 )
444 myIDSource[ iType ]->length(0);
445 myLineEdit[ iType ]->setText("");
447 disconnect(mySelectionMgr, 0, this, 0);
448 mySelectionMgr->clearFilters();
450 SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
451 if ( myMeshChk[ iType ]->isChecked() )
453 if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
454 mySelectionMgr->installFilter( myFilter[ iType ]);
456 else if ( aViewWindow )
459 case SMESH::NODE: aViewWindow->SetSelectionMode(NodeSelection); break;
460 case SMESH::EDGE: aViewWindow->SetSelectionMode(EdgeSelection); break;
461 case SMESH::FACE: aViewWindow->SetSelectionMode(FaceSelection); break;
465 myLineEdit[ iType ]->setFocus();
467 connect(mySelectionMgr, SIGNAL( currentSelectionChanged()), SLOT( selectionIntoArgument()));
468 selectionIntoArgument();
471 //================================================================================
473 * \brief Slot called when "Set filter" is clicked
475 //================================================================================
477 void SMESHGUI_3TypesSelector::setFilters()
479 if ( myMesh->_is_nil() ) {
480 SUIT_MessageBox::critical(this,
482 tr("NO_MESH_SELECTED"));
488 types.append( SMESH::NODE );
489 types.append( SMESH::EDGE );
490 types.append( SMESH::FACE );
491 myFilterDlg = new SMESHGUI_FilterDlg( SMESHGUI::GetSMESHGUI(), types );
494 QPushButton* send = (QPushButton*)sender();
495 for ( int iType = 0; iType < 3; ++iType )
496 if ( send == myFilterBtn[ iType ])
498 mySelectBtnGrp->button(iType)->click();
500 myFilterDlg->Init( SMESH::ElementType( iType+1 ) );
501 myFilterDlg->SetSelection();
502 myFilterDlg->SetMesh( myMesh );
503 myFilterDlg->SetSourceWg( myLineEdit[ iType ]);
509 //================================================================================
511 * \brief Clear selection
513 //================================================================================
515 void SMESHGUI_3TypesSelector::Clear()
518 for ( int iType = 0; iType < 3; ++iType )
520 myIDSource[ iType ]->length(0);
521 myLineEdit[ iType ]->setText("");
524 selectionIntoArgument();
527 //================================================================================
529 * \brief Enable/disable controls of a type
531 //================================================================================
533 void SMESHGUI_3TypesSelector::SetEnabled( bool enable, SMESH::ElementType type )
536 for ( int iType = 0; iType < 3; ++iType )
537 if ( iType+1 == type || type == SMESH::ALL )
539 myGroups[ iType ]->setEnabled( enable );
541 myIDSource[ iType ]->length(0);
542 myLineEdit[ iType ]->setText("");
546 selectionIntoArgument();
549 //================================================================================
551 * \brief Checks if anything is selected
553 //================================================================================
555 bool SMESHGUI_3TypesSelector::IsAnythingSelected( SMESH::ElementType type )
559 for ( int iType = 0; iType < 3; ++iType )
560 if ( iType+1 == type || type == SMESH::ALL )
561 nbSel += myIDSource[ iType ]->length();
566 //================================================================================
568 * \brief Returns selected elements and most complex type of selected elements
570 //================================================================================
572 SMESH::ElementType SMESHGUI_3TypesSelector::GetSelected( SMESH::ListOfIDSources & nodes,
573 SMESH::ListOfIDSources & edges,
574 SMESH::ListOfIDSources & faces )
576 nodes = myIDSource[0];
577 edges = myIDSource[1];
578 faces = myIDSource[2];
580 if ( myIDSource[2]->length() > 0 ) return SMESH::FACE;
581 if ( myIDSource[1]->length() > 0 ) return SMESH::EDGE;
582 if ( myIDSource[0]->length() > 0 ) return SMESH::NODE;
586 //=================================================================================
587 // function : SMESHGUI_ExtrusionDlg()
588 // purpose : constructor
589 //=================================================================================
591 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
592 : SMESHGUI_PreviewDlg( theModule ),
593 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
595 QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
598 setAttribute( Qt::WA_DeleteOnClose, true );
599 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
600 setSizeGripEnabled(true);
602 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
603 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
604 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
606 /***************************************************************/
607 GroupArguments = new QGroupBox(tr("SMESH_EXTRUSION"), this);
608 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
609 GroupArgumentsLayout->setSpacing(SPACING);
610 GroupArgumentsLayout->setMargin(MARGIN);
612 // Controls for elements selection
613 SelectorWdg = new SMESHGUI_3TypesSelector( GroupArguments );
615 ExtrMethod_RBut0 = new QRadioButton(GroupArguments);
616 ExtrMethod_RBut0->setText( tr("SMESH_EXTRUSION_TO_DISTANCE") );
617 ExtrMethod_RBut1 = new QRadioButton(GroupArguments);
618 ExtrMethod_RBut1->setText( tr("SMESH_EXTRUSION_ALONG_VECTOR") );
619 ExtrMethod_RBut2 = new QRadioButton(GroupArguments);
620 ExtrMethod_RBut2->setText( tr("SMESH_EXTRUSION_BY_NORMAL") );
622 //Control for the Distance selection
623 TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
625 TextLabelDx = new QLabel(tr("SMESH_X"), GroupArguments);
626 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
628 TextLabelDy = new QLabel(tr("SMESH_Y"), GroupArguments);
629 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
631 TextLabelDz = new QLabel(tr("SMESH_Z"), GroupArguments);
632 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
634 // Controls for vector selection
636 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
638 SelectVectorButton = new QPushButton(GroupArguments);
639 SelectVectorButton->setIcon(image);
640 SelectVectorButton->setCheckable( true );
641 SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
643 TextLabelVx = new QLabel(tr("SMESH_DX"), GroupArguments);
644 SpinBox_Vx = new SMESHGUI_SpinBox(GroupArguments);
646 TextLabelVy = new QLabel(tr("SMESH_DY"), GroupArguments);
647 SpinBox_Vy = new SMESHGUI_SpinBox(GroupArguments);
649 TextLabelVz = new QLabel(tr("SMESH_DZ"), GroupArguments);
650 SpinBox_Vz = new SMESHGUI_SpinBox(GroupArguments);
652 TextLabelDist = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
653 SpinBox_VDist = new SMESHGUI_SpinBox(GroupArguments);
655 // Controls for nb. steps defining
656 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
657 SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupArguments);
659 // CheckBox for groups generation
660 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
662 // CheckBox for ByAverageNormal arg of ExtrusionByNormal()
663 ByAverageNormalCheck = new QCheckBox(tr("BY_AVERAGE_NORMAL"), GroupArguments);
665 // CheckBox for UseInputElemsOnly arg of ExtrusionByNormal()
666 UseInputElemsOnlyCheck = new QCheckBox(tr("USE_INPUT_ELEMS_ONLY"), GroupArguments);
669 myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
671 GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 9);
672 GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 1, 0, 1, 3);
673 GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 1, 3, 1, 3);
674 GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 1, 6, 1, 3);
675 GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0);
676 GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
677 GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
678 GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
679 GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
680 GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
681 GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
682 GroupArgumentsLayout->addWidget(TextLabelVector, 3, 0);
683 GroupArgumentsLayout->addWidget(SelectVectorButton, 3, 1);
684 GroupArgumentsLayout->addWidget(TextLabelVx, 3, 2);
685 GroupArgumentsLayout->addWidget(SpinBox_Vx, 3, 3);
686 GroupArgumentsLayout->addWidget(TextLabelVy, 3, 4);
687 GroupArgumentsLayout->addWidget(SpinBox_Vy, 3, 5);
688 GroupArgumentsLayout->addWidget(TextLabelVz, 3, 6);
689 GroupArgumentsLayout->addWidget(SpinBox_Vz, 3, 7);
690 GroupArgumentsLayout->addWidget(TextLabelDist, 4, 0);
691 GroupArgumentsLayout->addWidget(SpinBox_VDist, 4, 3);
692 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 5, 0, 1, 3);
693 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 5, 3);
694 GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 6, 0, 1, 4);
695 GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 6, 4, 1, 4);
696 GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0, 1, 8);
697 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 8, 0, 1, 8);
698 GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0);
700 /***************************************************************/
701 GroupButtons = new QGroupBox(this);
702 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
703 GroupButtonsLayout->setSpacing(SPACING);
704 GroupButtonsLayout->setMargin(MARGIN);
706 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
707 buttonOk->setAutoDefault(true);
708 buttonOk->setDefault(true);
709 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
710 buttonApply->setAutoDefault(true);
711 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
712 buttonCancel->setAutoDefault(true);
713 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
714 buttonHelp->setAutoDefault(true);
716 GroupButtonsLayout->addWidget(buttonOk);
717 GroupButtonsLayout->addSpacing(10);
718 GroupButtonsLayout->addWidget(buttonApply);
719 GroupButtonsLayout->addSpacing(10);
720 GroupButtonsLayout->addStretch();
721 GroupButtonsLayout->addWidget(buttonCancel);
722 GroupButtonsLayout->addWidget(buttonHelp);
724 /***************************************************************/
725 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
726 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
728 /* Initialisations */
729 SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
730 SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
731 SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
733 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
734 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
735 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
737 SpinBox_NbSteps->setRange(1, 999999);
738 SpinBox_VDist->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
740 ExtrMethod_RBut0->setChecked(true);
741 UseInputElemsOnlyCheck->setChecked(true);
742 MakeGroupsCheck->setChecked(true);
744 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
746 mySMESHGUI->SetActiveDialogBox(this);
748 myHelpFileName = "extrusion_page.html";
752 /***************************************************************/
753 // signals and slots connections
754 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
755 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
756 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
757 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
759 connect(ExtrMethod_RBut0, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
760 connect(ExtrMethod_RBut1, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
761 connect(ExtrMethod_RBut2, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
763 // to update state of the Ok & Apply buttons
764 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
765 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
766 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
767 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
768 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
769 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
771 connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
772 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
773 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(toDisplaySimulation()));
774 connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(toDisplaySimulation()));
775 connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(CheckIsEnable()));
776 /* to close dialog if study change */
777 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
779 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
780 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
781 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
782 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
783 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
784 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
785 connect(SpinBox_VDist, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
786 connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
787 connect(ByAverageNormalCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
788 connect(UseInputElemsOnlyCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
790 //To Connect preview check box
791 connectPreviewControl();
793 /***************************************************************/
798 //=================================================================================
799 // function : ~SMESHGUI_ExtrusionDlg()
800 // purpose : destructor
801 //=================================================================================
802 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
806 //=================================================================================
808 // purpose : initialization
809 //=================================================================================
810 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
814 SpinBox_NbSteps->setValue(1);
815 SpinBox_VDist->setValue(10);
816 SpinBox_Dx->SetValue(0);
817 SpinBox_Dy->SetValue(0);
818 SpinBox_Dz->SetValue(0);
819 SpinBox_Vx->SetValue(0);
820 SpinBox_Vy->SetValue(0);
821 SpinBox_Vz->SetValue(0);
823 myPreviewCheckBox->setChecked(false);
824 onDisplaySimulation(false);
826 SelectorWdg->Clear();
830 //=================================================================================
831 // function : CheckIsEnable()
832 // purpose : Check whether the Ok and Apply buttons should be enabled or not
833 //=================================================================================
834 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
836 bool anIsEnable = SelectorWdg->IsAnythingSelected() && isValuesValid();
838 buttonOk->setEnabled(anIsEnable);
839 buttonApply->setEnabled(anIsEnable);
842 //=================================================================================
843 // function : isValuesValid()
844 // purpose : Return true in case if values entered into dialog are valid
845 //=================================================================================
846 bool SMESHGUI_ExtrusionDlg::isValuesValid()
848 double aX, aY, aZ, aModule = 0;
849 if ( ExtrMethod_RBut0->isChecked() )
851 aX = SpinBox_Dx->GetValue();
852 aY = SpinBox_Dy->GetValue();
853 aZ = SpinBox_Dz->GetValue();
854 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
856 else if ( ExtrMethod_RBut1->isChecked() )
858 aX = SpinBox_Vx->GetValue();
859 aY = SpinBox_Vy->GetValue();
860 aZ = SpinBox_Vz->GetValue();
861 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
862 double aVDist = (double)SpinBox_VDist->value();
865 else if ( ExtrMethod_RBut2->isChecked() )
867 aModule = (double)SpinBox_VDist->value();
870 return aModule > 1.0E-38;
873 //=================================================================================
874 // function : ClickOnRadio()
875 // purpose : Radio button management
876 //=================================================================================
878 void SMESHGUI_ExtrusionDlg::ClickOnRadio()
880 if ( ExtrMethod_RBut0->isChecked() )
882 TextLabelDistance->show();
890 TextLabelVector->hide();
897 TextLabelDist->hide();
898 SpinBox_VDist->hide();
899 SelectVectorButton->hide();
901 ByAverageNormalCheck->hide();
902 UseInputElemsOnlyCheck->hide();
904 SelectorWdg->SetEnabled( true, SMESH::ALL );
906 else if ( ExtrMethod_RBut1->isChecked() )
908 TextLabelDistance->hide();
916 TextLabelVector->show();
923 TextLabelDist->show();
924 SpinBox_VDist->show();
925 SelectVectorButton->show();
927 ByAverageNormalCheck->hide();
928 UseInputElemsOnlyCheck->hide();
930 SelectorWdg->SetEnabled( true, SMESH::ALL );
932 else if ( ExtrMethod_RBut2->isChecked() )
934 TextLabelDistance->hide();
942 TextLabelVector->hide();
950 TextLabelDist->show();
951 SpinBox_VDist->show();
952 SelectVectorButton->hide();
954 ByAverageNormalCheck->show();
955 UseInputElemsOnlyCheck->show();
957 SelectorWdg->SetEnabled( false, SMESH::NODE );
958 SelectorWdg->SetEnabled( false, SMESH::EDGE );
963 onDisplaySimulation(true);
965 qApp->processEvents();
967 resize( minimumSizeHint() );
970 //=================================================================================
971 // function : ClickOnApply()
972 // purpose : Called when user presses <Apply> button
973 //=================================================================================
975 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
977 if (mySMESHGUI->isActiveStudyLocked())
983 if ( SelectorWdg->IsAnythingSelected() )
985 SMESH::DirStruct aVector;
986 getExtrusionVector(aVector);
988 QStringList aParameters;
989 if ( ExtrMethod_RBut0->isChecked() )
991 aParameters << SpinBox_Dx->text();
992 aParameters << SpinBox_Dy->text();
993 aParameters << SpinBox_Dz->text();
995 else if ( ExtrMethod_RBut1->isChecked() )
997 // only 3 coords in a python dump command :(
998 // aParameters << SpinBox_Vx->text();
999 // aParameters << SpinBox_Vy->text();
1000 // aParameters << SpinBox_Vz->text();
1001 // aParameters << SpinBox_VDist->text();
1003 else if ( ExtrMethod_RBut2->isChecked() )
1005 aParameters << SpinBox_VDist->text();
1008 long aNbSteps = (long)SpinBox_NbSteps->value();
1010 aParameters << SpinBox_NbSteps->text();
1012 bool meshHadNewTypeBefore = true;
1014 const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
1017 SUIT_OverrideCursor aWaitCursor;
1019 SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
1021 SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
1022 SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
1023 SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
1024 maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
1026 // is it necessary to switch on the next Display Mode?
1027 SMESH::ElementType newType = (SMESH::ElementType)( maxSelType + 1 );
1028 SMESH::array_of_ElementType_var oldTypes = mesh->GetTypes();
1029 meshHadNewTypeBefore = false;
1030 for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i )
1031 meshHadNewTypeBefore = ( oldTypes[i] >= newType );
1033 SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditor();
1034 SMESH::ListOfGroups_var groups;
1036 mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
1038 if ( ExtrMethod_RBut2->isVisible() &&
1039 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
1041 double stepSize = (double) SpinBox_VDist->value();
1042 long nbSteps = (long) SpinBox_NbSteps->value();
1043 bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
1044 bool byAverageNormal = ByAverageNormalCheck->isChecked();
1045 int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
1047 groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
1048 byAverageNormal, makeGroups, dim );
1052 groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
1053 aVector, aNbSteps, makeGroups );
1059 SMESH_Actor* actor = SelectorWdg->GetActor();
1060 if ( actor && !meshHadNewTypeBefore )
1062 unsigned int aMode = actor->GetEntityMode();
1063 switch ( maxSelType ) {
1064 case SMESH::NODE: // extrude node -> edges
1065 actor->SetRepresentation(SMESH_Actor::eEdge);
1066 actor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
1067 case SMESH::EDGE: // edge -> faces
1068 actor->SetRepresentation(SMESH_Actor::eSurface);
1069 actor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
1070 case SMESH::FACE: // faces -> volumes
1071 actor->SetRepresentation(SMESH_Actor::eSurface);
1072 actor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
1076 SMESH::Update( actor->getIO(), actor->GetVisibility() );
1078 mySMESHGUI->updateObjBrowser(true); // new groups may appear
1080 mySelectionMgr->clearSelected();
1081 SelectorWdg->Clear();
1083 SMESHGUI::Modified();
1088 //=================================================================================
1089 // function : ClickOnOk()
1090 // purpose : Called when user presses <OK> button
1091 //=================================================================================
1092 void SMESHGUI_ExtrusionDlg::ClickOnOk()
1098 //=================================================================================
1099 // function : reject()
1100 // purpose : Called when dialog box is closed
1101 //=================================================================================
1102 void SMESHGUI_ExtrusionDlg::reject()
1104 disconnect(mySelectionMgr, 0, this, 0);
1105 mySelectionMgr->clearFilters();
1106 //mySelectionMgr->clearSelected();
1107 if (SMESH::GetCurrentVtkView()) {
1108 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
1109 SMESH::SetPointRepresentation(false);
1110 SMESH::SetPickable();
1112 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1113 aViewWindow->SetSelectionMode(ActorSelection);
1114 mySMESHGUI->ResetState();
1119 //=================================================================================
1120 // function : ClickOnHelp()
1122 //=================================================================================
1123 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
1125 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
1127 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
1131 platform = "winapplication";
1133 platform = "application";
1135 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
1136 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
1137 arg(app->resourceMgr()->stringValue("ExternalBrowser",
1139 arg(myHelpFileName));
1143 //=================================================================================
1144 // function : SelectionIntoArgument()
1145 // purpose : Called when selection has changed or other case
1146 //=================================================================================
1147 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
1149 // return if dialog box is inactive
1150 if (!GroupButtons->isEnabled())
1153 if ( SelectVectorButton->isChecked() )
1155 SALOME_ListIO aList;
1156 mySelectionMgr->selectedObjects(aList);
1157 if ( aList.IsEmpty() || aList.Extent() > 1 )
1160 Handle(SALOME_InteractiveObject) IO = aList.First();
1161 TColStd_IndexedMapOfInteger aMapIndex;
1162 mySelector->GetIndex(IO,aMapIndex);
1163 if ( aMapIndex.Extent() != 1 )
1165 SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
1166 SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
1170 const SMDS_MeshFace* face =
1171 dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
1175 gp_XYZ aNormale = SMESH::getNormale(face);
1176 SpinBox_Vx->SetValue(aNormale.X());
1177 SpinBox_Vy->SetValue(aNormale.Y());
1178 SpinBox_Vz->SetValue(aNormale.Z());
1181 onDisplaySimulation(true);
1185 //=================================================================================
1186 // function : SetEditCurrentArgument()
1188 //=================================================================================
1189 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
1191 QPushButton* send = (QPushButton*)sender();
1193 disconnect(mySelectionMgr, 0, this, 0);
1194 mySelectionMgr->clearSelected();
1195 mySelectionMgr->clearFilters();
1197 if (send == SelectVectorButton)
1199 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1200 aViewWindow->SetSelectionMode(FaceSelection);
1203 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1204 SelectionIntoArgument();
1207 //=================================================================================
1208 // function : DeactivateActiveDialog()
1209 // purpose : Deactivates this dialog
1210 //=================================================================================
1211 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
1213 if (GroupButtons->isEnabled())
1215 GroupArguments->setEnabled(false);
1216 GroupButtons->setEnabled(false);
1217 SelectorWdg->setEnabled(false);
1218 mySMESHGUI->ResetState();
1219 mySMESHGUI->SetActiveDialogBox(0);
1223 //=================================================================================
1224 // function : ActivateThisDialog()
1225 // purpose : Activates this dialog
1226 //=================================================================================
1227 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
1229 // Emit a signal to deactivate the active dialog
1230 mySMESHGUI->EmitSignalDeactivateDialog();
1231 GroupArguments->setEnabled(true);
1232 GroupButtons->setEnabled(true);
1233 SelectorWdg->setEnabled(true);
1235 mySMESHGUI->SetActiveDialogBox(this);
1238 //=================================================================================
1239 // function : enterEvent()
1240 // purpose : Mouse enter event
1241 //=================================================================================
1242 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
1244 if (!GroupButtons->isEnabled())
1245 ActivateThisDialog();
1248 //=================================================================================
1249 // function : keyPressEvent()
1251 //=================================================================================
1252 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
1254 QDialog::keyPressEvent( e );
1255 if ( e->isAccepted() )
1258 if ( e->key() == Qt::Key_F1 ) {
1264 //=================================================================================
1265 // function : isValid
1267 //=================================================================================
1268 bool SMESHGUI_ExtrusionDlg::isValid()
1272 if ( ExtrMethod_RBut0->isChecked() ) {
1273 ok = SpinBox_Dx->isValid( msg, true ) && ok;
1274 ok = SpinBox_Dy->isValid( msg, true ) && ok;
1275 ok = SpinBox_Dz->isValid( msg, true ) && ok;
1276 } else if ( ExtrMethod_RBut1->isChecked() ) {
1277 ok = SpinBox_Vx->isValid( msg, true ) && ok;
1278 ok = SpinBox_Vy->isValid( msg, true ) && ok;
1279 ok = SpinBox_Vz->isValid( msg, true ) && ok;
1280 ok = SpinBox_VDist->isValid( msg, true ) && ok;
1282 ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
1285 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1286 if ( !msg.isEmpty() )
1288 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1294 //=================================================================================
1295 // function : onDisplaySimulation
1296 // purpose : Show/Hide preview
1297 //=================================================================================
1298 void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
1300 if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1301 if ( SelectorWdg->IsAnythingSelected() && isValid() && isValuesValid())
1304 SMESH::DirStruct aVector;
1305 getExtrusionVector(aVector);
1307 //Get Number of the steps
1308 long aNbSteps = (long)SpinBox_NbSteps->value();
1311 SUIT_OverrideCursor aWaitCursor;
1313 SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
1314 SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditPreviewer();
1315 SMESH::ListOfGroups_var groups;
1317 SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
1318 SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
1319 SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
1320 const int maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
1321 const bool makeGroups = false;
1323 if ( ExtrMethod_RBut2->isVisible() &&
1324 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
1326 double stepSize = (double) SpinBox_VDist->value();
1327 long nbSteps = (long) SpinBox_NbSteps->value();
1328 bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
1329 bool byAverageNormal = ByAverageNormalCheck->isChecked();
1330 int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
1332 groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
1333 byAverageNormal, makeGroups, dim );
1337 groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
1338 aVector, aNbSteps, makeGroups );
1340 SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
1341 mySimulation->SetData(aMeshPreviewStruct._retn());
1354 //=================================================================================
1355 // function : getExtrusionVector()
1356 // purpose : get direction of the extrusion
1357 //=================================================================================
1358 void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector)
1360 if ( ExtrMethod_RBut0->isChecked() )
1362 aVector.PS.x = SpinBox_Dx->GetValue();
1363 aVector.PS.y = SpinBox_Dy->GetValue();
1364 aVector.PS.z = SpinBox_Dz->GetValue();
1366 else if ( ExtrMethod_RBut1->isChecked() )
1368 gp_XYZ aNormale(SpinBox_Vx->GetValue(),
1369 SpinBox_Vy->GetValue(),
1370 SpinBox_Vz->GetValue());
1371 aNormale /= aNormale.Modulus();
1372 double aVDist = (double)SpinBox_VDist->value();
1374 aVector.PS.x = aNormale.X()*aVDist;
1375 aVector.PS.y = aNormale.Y()*aVDist;
1376 aVector.PS.z = aNormale.Z()*aVDist;