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)
87 //=================================================================================
88 // function : SMESHGUI_ExtrusionDlg()
89 // purpose : constructor
90 //=================================================================================
91 SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
92 : SMESHGUI_PreviewDlg( theModule ),
93 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
94 myEditCurrentArgument(0),
96 mySelectedObject(SMESH::SMESH_IDSource::_nil())
98 QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
99 QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
100 QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
101 QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
104 setAttribute( Qt::WA_DeleteOnClose, true );
105 setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
106 setSizeGripEnabled(true);
108 QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
109 SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
110 SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
112 /***************************************************************/
113 ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
114 GroupConstructors = new QButtonGroup(this);
115 QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
116 ConstructorsBoxLayout->setSpacing(SPACING);
117 ConstructorsBoxLayout->setMargin(MARGIN);
119 Contructor_RBut0= new QRadioButton(ConstructorsBox);
120 Contructor_RBut0->setIcon(image3);
121 Contructor_RBut1= new QRadioButton(ConstructorsBox);
122 Contructor_RBut1->setIcon(image0);
123 Contructor_RBut2= new QRadioButton(ConstructorsBox);
124 Contructor_RBut2->setIcon(image1);
126 ConstructorsBoxLayout->addWidget(Contructor_RBut0);
127 ConstructorsBoxLayout->addWidget(Contructor_RBut1);
128 ConstructorsBoxLayout->addWidget(Contructor_RBut2);
130 GroupConstructors->addButton(Contructor_RBut0, 0);
131 GroupConstructors->addButton(Contructor_RBut1, 1);
132 GroupConstructors->addButton(Contructor_RBut2, 2);
134 /***************************************************************/
135 GroupButtons = new QGroupBox(this);
136 QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
137 GroupButtonsLayout->setSpacing(SPACING);
138 GroupButtonsLayout->setMargin(MARGIN);
140 buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
141 buttonOk->setAutoDefault(true);
142 buttonOk->setDefault(true);
143 buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
144 buttonApply->setAutoDefault(true);
145 buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
146 buttonCancel->setAutoDefault(true);
147 buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
148 buttonHelp->setAutoDefault(true);
150 GroupButtonsLayout->addWidget(buttonOk);
151 GroupButtonsLayout->addSpacing(10);
152 GroupButtonsLayout->addWidget(buttonApply);
153 GroupButtonsLayout->addSpacing(10);
154 GroupButtonsLayout->addStretch();
155 GroupButtonsLayout->addWidget(buttonCancel);
156 GroupButtonsLayout->addWidget(buttonHelp);
158 /***************************************************************/
159 GroupArguments = new QGroupBox(tr("EXTRUSION_0D"), this);
160 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
161 GroupArgumentsLayout->setSpacing(SPACING);
162 GroupArgumentsLayout->setMargin(MARGIN);
164 myIdValidator = new SMESHGUI_IdValidator(this);
166 // Controls for elements selection
167 TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
169 SelectElementsButton = new QPushButton(GroupArguments);
170 SelectElementsButton->setIcon(image2);
172 LineEditElements = new QLineEdit(GroupArguments);
173 LineEditElements->setValidator(myIdValidator);
174 LineEditElements->setMaxLength(-1);
175 myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
176 connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
178 // Control for the whole mesh selection
179 CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
181 ExtrMethod_RBut0 = new QRadioButton(GroupArguments);
182 ExtrMethod_RBut0->setText( tr("SMESH_EXTRUSION_TO_DISTANCE") );
183 ExtrMethod_RBut1 = new QRadioButton(GroupArguments);
184 ExtrMethod_RBut1->setText( tr("SMESH_EXTRUSION_ALONG_VECTOR") );
185 ExtrMethod_RBut2 = new QRadioButton(GroupArguments);
186 ExtrMethod_RBut2->setText( tr("SMESH_EXTRUSION_BY_NORMAL") );
188 //Control for the Distance selection
189 TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
191 TextLabelDx = new QLabel(tr("SMESH_X"), GroupArguments);
192 SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
194 TextLabelDy = new QLabel(tr("SMESH_Y"), GroupArguments);
195 SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
197 TextLabelDz = new QLabel(tr("SMESH_Z"), GroupArguments);
198 SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
200 // Controls for vector selection
202 TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
204 SelectVectorButton = new QPushButton(GroupArguments);
205 SelectVectorButton->setIcon(image2);
207 TextLabelVx = new QLabel(tr("SMESH_DX"), GroupArguments);
208 SpinBox_Vx = new SMESHGUI_SpinBox(GroupArguments);
210 TextLabelVy = new QLabel(tr("SMESH_DY"), GroupArguments);
211 SpinBox_Vy = new SMESHGUI_SpinBox(GroupArguments);
213 TextLabelVz = new QLabel(tr("SMESH_DZ"), GroupArguments);
214 SpinBox_Vz = new SMESHGUI_SpinBox(GroupArguments);
216 TextLabelDist = new QLabel(tr("SMESH_DISTANCE"), GroupArguments);
217 SpinBox_VDist = new SMESHGUI_SpinBox(GroupArguments);
219 // Controls for nb. steps defining
220 TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
221 SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupArguments);
223 // CheckBox for groups generation
224 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
226 // CheckBox for ByAverageNormal arg of ExtrusionByNormal()
227 ByAverageNormalCheck = new QCheckBox(tr("BY_AVERAGE_NORMAL"), GroupArguments);
229 // CheckBox for UseInputElemsOnly arg of ExtrusionByNormal()
230 UseInputElemsOnlyCheck = new QCheckBox(tr("USE_INPUT_ELEMS_ONLY"), GroupArguments);
233 myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
235 GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
236 GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
237 GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
238 GroupArgumentsLayout->addWidget(myFilterBtn, 0, 7);
239 GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
240 GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 2, 0, 1, 3);
241 GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 2, 3, 1, 3);
242 GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 2, 6, 1, 3);
243 GroupArgumentsLayout->addWidget(TextLabelDistance, 3, 0);
244 GroupArgumentsLayout->addWidget(TextLabelDx, 3, 2);
245 GroupArgumentsLayout->addWidget(SpinBox_Dx, 3, 3);
246 GroupArgumentsLayout->addWidget(TextLabelDy, 3, 4);
247 GroupArgumentsLayout->addWidget(SpinBox_Dy, 3, 5);
248 GroupArgumentsLayout->addWidget(TextLabelDz, 3, 6);
249 GroupArgumentsLayout->addWidget(SpinBox_Dz, 3, 7);
250 GroupArgumentsLayout->addWidget(TextLabelVector, 4, 0);
251 GroupArgumentsLayout->addWidget(SelectVectorButton, 4, 1);
252 GroupArgumentsLayout->addWidget(TextLabelVx, 4, 2);
253 GroupArgumentsLayout->addWidget(SpinBox_Vx, 4, 3);
254 GroupArgumentsLayout->addWidget(TextLabelVy, 4, 4);
255 GroupArgumentsLayout->addWidget(SpinBox_Vy, 4, 5);
256 GroupArgumentsLayout->addWidget(TextLabelVz, 4, 6);
257 GroupArgumentsLayout->addWidget(SpinBox_Vz, 4, 7);
258 GroupArgumentsLayout->addWidget(TextLabelDist, 5, 0);
259 GroupArgumentsLayout->addWidget(SpinBox_VDist, 5, 3);
260 GroupArgumentsLayout->addWidget(TextLabelNbSteps, 6, 0, 1, 3);
261 GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 6, 3);
262 GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 7, 0, 1, 4);
263 GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 7, 4, 1, 4);
264 GroupArgumentsLayout->addWidget(myPreviewCheckBox, 8, 0, 1, 8);
265 GroupArgumentsLayout->addWidget(MakeGroupsCheck, 9, 0, 1, 8);
266 GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0);
269 /***************************************************************/
270 SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
271 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
272 SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
274 /* Initialisations */
275 SpinBox_Vx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
276 SpinBox_Vy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
277 SpinBox_Vz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, "length_precision");
279 SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
280 SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
281 SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
283 SpinBox_NbSteps->setRange(1, 999999);
284 SpinBox_VDist->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
286 Contructor_RBut0->setChecked(true);
287 ExtrMethod_RBut0->setChecked(true);
288 UseInputElemsOnlyCheck->setChecked(true);
289 MakeGroupsCheck->setChecked(true);
291 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
293 mySMESHGUI->SetActiveDialogBox(this);
295 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
296 QList<SUIT_SelectionFilter*> aListOfFilters;
297 aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH));
298 aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX));
299 aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE));
300 myMeshOrSubMeshOrGroupFilter0D =
301 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
302 aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
303 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
304 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
305 myMeshOrSubMeshOrGroupFilter1D =
306 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
307 aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
308 aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
309 aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
310 myMeshOrSubMeshOrGroupFilter2D =
311 new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
313 myHelpFileName = "extrusion_page.html";
317 /***************************************************************/
318 // signals and slots connections
319 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
320 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
321 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
322 connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
324 connect(ExtrMethod_RBut0, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
325 connect(ExtrMethod_RBut1, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
326 connect(ExtrMethod_RBut2, SIGNAL(clicked()), this, SLOT(ClickOnRadio()));
328 // to update state of the Ok & Apply buttons
329 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
330 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
331 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
332 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
333 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
334 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
336 connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
337 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
338 connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
339 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
340 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
341 /* to close dialog if study change */
342 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
343 connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
344 connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
346 connect(SpinBox_Dx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
347 connect(SpinBox_Dy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
348 connect(SpinBox_Dz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
349 connect(SpinBox_Vx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
350 connect(SpinBox_Vy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
351 connect(SpinBox_Vz, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
352 connect(SpinBox_VDist, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
353 connect(SpinBox_NbSteps, SIGNAL(valueChanged(int)), this, SLOT(toDisplaySimulation()));
354 connect(ByAverageNormalCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
355 connect(UseInputElemsOnlyCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
357 //To Connect preview check box
358 connectPreviewControl();
360 /***************************************************************/
362 ConstructorsClicked(0);
364 SelectionIntoArgument();
367 //=================================================================================
368 // function : ~SMESHGUI_ExtrusionDlg()
369 // purpose : destructor
370 //=================================================================================
371 SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
373 if ( myFilterDlg != 0 ) {
374 myFilterDlg->setParent( 0 );
377 if ( myMeshOrSubMeshOrGroupFilter0D ) delete myMeshOrSubMeshOrGroupFilter0D;
378 if ( myMeshOrSubMeshOrGroupFilter1D ) delete myMeshOrSubMeshOrGroupFilter1D;
379 if ( myMeshOrSubMeshOrGroupFilter2D ) delete myMeshOrSubMeshOrGroupFilter2D;
382 //=================================================================================
384 // purpose : initialization
385 //=================================================================================
386 void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
391 LineEditElements->clear();
395 myMesh = SMESH::SMESH_Mesh::_nil();
398 SpinBox_NbSteps->setValue(1);
399 SpinBox_VDist->setValue(10);
400 SpinBox_Dx->SetValue(0);
401 SpinBox_Dy->SetValue(0);
402 SpinBox_Dz->SetValue(0);
403 SpinBox_Vx->SetValue(0);
404 SpinBox_Vy->SetValue(0);
405 SpinBox_Vz->SetValue(0);
407 CheckBoxMesh->setChecked(false);
409 myPreviewCheckBox->setChecked(false);
410 onDisplaySimulation(false);
416 //=================================================================================
417 // function : CheckIsEnable()
418 // purpose : Check whether the Ok and Apply buttons should be enabled or not
419 //=================================================================================
420 void SMESHGUI_ExtrusionDlg::CheckIsEnable()
422 bool anIsEnable = myNbOkElements > 0 && isValuesValid();
424 buttonOk->setEnabled(anIsEnable);
425 buttonApply->setEnabled(anIsEnable);
428 //=================================================================================
429 // function : isValuesValid()
430 // purpose : Return true in case if values entered into dialog are valid
431 //=================================================================================
432 bool SMESHGUI_ExtrusionDlg::isValuesValid() {
433 double aX, aY, aZ, aModule = 0;
434 if ( ExtrMethod_RBut0->isChecked() ) {
435 aX = SpinBox_Dx->GetValue();
436 aY = SpinBox_Dy->GetValue();
437 aZ = SpinBox_Dz->GetValue();
438 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
440 else if ( ExtrMethod_RBut1->isChecked() ) {
441 aX = SpinBox_Vx->GetValue();
442 aY = SpinBox_Vy->GetValue();
443 aZ = SpinBox_Vz->GetValue();
444 aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
446 else if ( ExtrMethod_RBut2->isChecked() ) {
450 return aModule > 1.0E-38;
453 //=================================================================================
454 // function : ConstructorsClicked()
455 // purpose : Radio button management
456 //=================================================================================
457 void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
459 disconnect(mySelectionMgr, 0, this, 0);
463 TextLabelElements->setText(tr( constructorId ? "SMESH_ID_ELEMENTS" : "SMESH_ID_NODES"));
465 switch (constructorId) {
468 GroupArguments->setTitle(tr("EXTRUSION_0D"));
469 if (!CheckBoxMesh->isChecked())
471 LineEditElements->clear();
473 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
474 aViewWindow->SetSelectionMode(NodeSelection);
480 GroupArguments->setTitle(tr("EXTRUSION_1D"));
481 if (!CheckBoxMesh->isChecked())
483 LineEditElements->clear();
485 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
486 aViewWindow->SetSelectionMode(EdgeSelection);
492 GroupArguments->setTitle(tr("EXTRUSION_2D"));
493 if (!CheckBoxMesh->isChecked())
495 LineEditElements->clear();
497 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
498 aViewWindow->SetSelectionMode(FaceSelection);
504 ExtrMethod_RBut2->setVisible( constructorId == 2 );
505 if ( !ExtrMethod_RBut2->isVisible() &&
506 ExtrMethod_RBut2->isChecked() )
507 ExtrMethod_RBut0->click();
509 myEditCurrentArgument = (QWidget*)LineEditElements;
510 LineEditElements->setFocus();
512 if (CheckBoxMesh->isChecked())
515 myEditCurrentArgument->hide();
516 myEditCurrentArgument->show();
518 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
521 //=================================================================================
522 // function : ConstructorsClicked()
523 // purpose : Radio button management
524 //=================================================================================
525 void SMESHGUI_ExtrusionDlg::ClickOnRadio()
527 if ( ExtrMethod_RBut0->isChecked() )
529 TextLabelDistance->show();
537 TextLabelVector->hide();
544 TextLabelDist->hide();
545 SpinBox_VDist->hide();
546 SelectVectorButton->hide();
548 ByAverageNormalCheck->hide();
549 UseInputElemsOnlyCheck->hide();
551 else if ( ExtrMethod_RBut1->isChecked() )
553 TextLabelDistance->hide();
561 TextLabelVector->show();
568 TextLabelDist->show();
569 SpinBox_VDist->show();
570 SelectVectorButton->show();
572 ByAverageNormalCheck->hide();
573 UseInputElemsOnlyCheck->hide();
575 else if ( ExtrMethod_RBut2->isChecked() )
577 TextLabelDistance->hide();
585 TextLabelVector->hide();
593 TextLabelDist->show();
594 SpinBox_VDist->show();
595 SelectVectorButton->hide();
597 ByAverageNormalCheck->show();
598 UseInputElemsOnlyCheck->show();
603 onDisplaySimulation(true);
605 qApp->processEvents();
607 resize( minimumSizeHint() );
610 //=================================================================================
611 // function : ClickOnApply()
612 // purpose : Called when user presses <Apply> button
613 //=================================================================================
614 bool SMESHGUI_ExtrusionDlg::ClickOnApply()
616 if (mySMESHGUI->isActiveStudyLocked())
622 if (myNbOkElements) {
624 SMESH::DirStruct aVector;
625 getExtrusionVector(aVector);
627 QStringList aParameters;
628 if ( ExtrMethod_RBut0->isChecked() )
630 aParameters << SpinBox_Dx->text();
631 aParameters << SpinBox_Dy->text();
632 aParameters << SpinBox_Dz->text();
634 else if ( ExtrMethod_RBut1->isChecked() )
636 // only 3 coords in a python dump command :(
637 // aParameters << SpinBox_Vx->text();
638 // aParameters << SpinBox_Vy->text();
639 // aParameters << SpinBox_Vz->text();
640 // aParameters << SpinBox_VDist->text();
642 else if ( ExtrMethod_RBut2->isChecked() )
644 aParameters << SpinBox_VDist->text();
647 long aNbSteps = (long)SpinBox_NbSteps->value();
649 aParameters << SpinBox_NbSteps->text();
651 bool meshHadNewTypeBefore = true;
654 SUIT_OverrideCursor aWaitCursor;
656 // is it necessary to switch on the next Display Mode?
657 SMESH::ElementType newType = (SMESH::ElementType)( SMESH::EDGE + GetConstructorId() );
658 SMESH::array_of_ElementType_var oldTypes = myMesh->GetTypes();
659 meshHadNewTypeBefore = false;
660 for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i )
661 meshHadNewTypeBefore = ( oldTypes[i] >= newType );
663 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
665 myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
667 const bool makeGroups = MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked();
669 if ( ExtrMethod_RBut2->isVisible() &&
670 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
672 extrusionByNormal( aMeshEditor, makeGroups );
674 else if ( makeGroups ) // create groups
676 SMESH::ListOfGroups_var groups;
677 if( CheckBoxMesh->isChecked() )
678 switch (GetConstructorId() ) {
680 groups = aMeshEditor->ExtrusionSweepObject0DMakeGroups(mySelectedObject, aVector,
683 groups = aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector,
686 groups = aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector,
691 if (GetConstructorId() == 0)
692 groups = aMeshEditor->ExtrusionSweepMakeGroups0D(myElementsId.inout(), aVector,
695 groups = aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector,
701 if( CheckBoxMesh->isChecked() )
702 switch( GetConstructorId() ) {
704 aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps);
707 aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
710 aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
714 if (GetConstructorId() == 0)
715 aMeshEditor->ExtrusionSweep0D(myElementsId.inout(), aVector, aNbSteps);
717 aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
723 if ( myActor && !meshHadNewTypeBefore )
725 unsigned int aMode = myActor->GetEntityMode();
726 switch ( GetConstructorId() ) {
727 case 0: // extrude node -> edges
728 myActor->SetRepresentation(SMESH_Actor::eEdge);
729 myActor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
730 case 1: // edge -> faces
731 myActor->SetRepresentation(SMESH_Actor::eSurface);
732 myActor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
733 case 2: // faces -> volumes
734 myActor->SetRepresentation(SMESH_Actor::eSurface);
735 myActor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
738 SMESH::Update(myIO, SMESH::eDisplay);
739 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
740 mySMESHGUI->updateObjBrowser(true); // new groups may appear
742 mySelectionMgr->clearSelected();
743 mySelectedObject = SMESH::SMESH_IDSource::_nil();
744 SelectionIntoArgument();
745 ConstructorsClicked(GetConstructorId());
747 SMESHGUI::Modified();
752 //=================================================================================
753 // function : ClickOnOk()
754 // purpose : Called when user presses <OK> button
755 //=================================================================================
756 void SMESHGUI_ExtrusionDlg::ClickOnOk()
762 //=================================================================================
763 // function : reject()
764 // purpose : Called when dialog box is closed
765 //=================================================================================
766 void SMESHGUI_ExtrusionDlg::reject()
768 disconnect(mySelectionMgr, 0, this, 0);
769 mySelectionMgr->clearFilters();
770 //mySelectionMgr->clearSelected();
771 if (SMESH::GetCurrentVtkView()) {
772 SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
773 SMESH::SetPointRepresentation(false);
774 SMESH::SetPickable();
776 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
777 aViewWindow->SetSelectionMode(ActorSelection);
778 mySMESHGUI->ResetState();
783 //=================================================================================
784 // function : ClickOnHelp()
786 //=================================================================================
787 void SMESHGUI_ExtrusionDlg::ClickOnHelp()
789 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
791 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
795 platform = "winapplication";
797 platform = "application";
799 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
800 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
801 arg(app->resourceMgr()->stringValue("ExternalBrowser",
803 arg(myHelpFileName));
807 //=================================================================================
808 // function : onTextChange()
810 //=================================================================================
811 void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
813 QLineEdit* send = (QLineEdit*)sender();
821 if (send == LineEditElements)
824 // hilight entered elements/nodes
826 if (!myIO.IsNull()) {
827 QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
829 if (send == LineEditElements)
831 SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
832 SMESH::ElementType SMESHType;
833 SMDSAbs_ElementType SMDSType;
834 switch (GetConstructorId()) {
837 SMESHType = SMESH::NODE;
838 SMDSType = SMDSAbs_Node;
843 SMESHType = SMESH::EDGE;
844 SMDSType = SMDSAbs_Edge;
849 SMESHType = SMESH::FACE;
850 SMDSType = SMDSAbs_Face;
854 myElementsId = new SMESH::long_array;
855 myElementsId->length( aListId.count() );
856 TColStd_MapOfInteger newIndices;
857 for (int i = 0; i < aListId.count(); i++) {
858 int id = aListId[ i ].toInt();
859 bool validId = false;
862 const SMDS_MeshElement * e;
863 if (SMDSType == SMDSAbs_Node)
864 e = aMesh->FindNode( id );
866 e = aMesh->FindElement( id );
867 validId = ( e && e->GetType() == SMDSType );
869 validId = ( myMesh->GetElementType( id, true ) == SMESHType );
872 if ( validId && newIndices.Add( id ))
873 myElementsId[ newIndices.Extent()-1 ] = id;
875 myElementsId->length( myNbOkElements = newIndices.Extent() );
876 mySelector->AddOrRemoveIndex(myIO, newIndices, false);
877 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
878 aViewWindow->highlight( myIO, true, true );
884 onDisplaySimulation(true);
889 //=================================================================================
890 // function : SelectionIntoArgument()
891 // purpose : Called when selection as changed or other case
892 //=================================================================================
893 void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
897 // return if dialog box is inactive
898 if (!GroupButtons->isEnabled())
902 if(myEditCurrentArgument != (QWidget*)SpinBox_Vx) {
904 Handle(SALOME_InteractiveObject) resIO = myIO;
908 QString aString = "";
910 if(myEditCurrentArgument == (QWidget*)LineEditElements) {
912 LineEditElements->setText(aString);
918 mySelectionMgr->selectedObjects(aList);
919 int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
923 Handle(SALOME_InteractiveObject) IO = aList.First();
925 if(myEditCurrentArgument != (QWidget*)SpinBox_Vx) {
926 myMesh = SMESH::GetMeshByIO(IO);
927 if (myMesh->_is_nil())
930 myActor = SMESH::FindActorByObject(myMesh);
933 if (myEditCurrentArgument == (QWidget*)LineEditElements) {
936 // MakeGroups is available if there are groups
937 if ( myMesh->NbGroups() == 0 ) {
938 MakeGroupsCheck->setChecked(false);
939 MakeGroupsCheck->setEnabled(false);
941 MakeGroupsCheck->setEnabled(true);
944 if (CheckBoxMesh->isChecked()) {
945 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
947 if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
948 mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
952 // get indices of selected elements
953 TColStd_IndexedMapOfInteger aMapIndex;
954 mySelector->GetIndex(IO,aMapIndex);
955 aNbElements = aMapIndex.Extent();
960 myElementsId = new SMESH::long_array;
961 myElementsId->length( aNbElements );
963 for ( int i = 0; i < aNbElements; ++i )
964 aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
967 myNbOkElements = true;
970 ((QLineEdit*)myEditCurrentArgument)->setText(aString);
973 else if(myEditCurrentArgument == (QWidget*)SpinBox_Vx){
974 TColStd_IndexedMapOfInteger aMapIndex;
975 mySelector->GetIndex(IO,aMapIndex);
976 int aNbElements = aMapIndex.Extent();
977 SMESH::SMESH_Mesh_var aMesh_var = SMESH::GetMeshByIO(IO);
978 SMESH_Actor* anActor = SMESH::FindActorByObject(aMesh_var);
979 SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
981 if(aNbElements != 1 || !aMesh)
984 const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(aNbElements)));
989 gp_XYZ aNormale = SMESH::getNormale(face);
990 SpinBox_Vx->SetValue(aNormale.X());
991 SpinBox_Vy->SetValue(aNormale.Y());
992 SpinBox_Vz->SetValue(aNormale.Z());
996 onDisplaySimulation(true);
1002 //=================================================================================
1003 // function : SetEditCurrentArgument()
1005 //=================================================================================
1006 void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
1008 QPushButton* send = (QPushButton*)sender();
1010 disconnect(mySelectionMgr, 0, this, 0);
1011 mySelectionMgr->clearSelected();
1012 mySelectionMgr->clearFilters();
1014 if (send == SelectElementsButton) {
1015 myEditCurrentArgument = (QWidget*)LineEditElements;
1016 if (CheckBoxMesh->isChecked())
1018 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1019 aViewWindow->SetSelectionMode(ActorSelection);
1020 switch( GetConstructorId() ) {
1021 case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
1022 case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
1023 case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
1028 int aConstructorId = GetConstructorId();
1029 switch(aConstructorId) {
1032 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1033 aViewWindow->SetSelectionMode(NodeSelection);
1038 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1039 aViewWindow->SetSelectionMode(EdgeSelection);
1044 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1045 aViewWindow->SetSelectionMode(FaceSelection);
1051 else if (send == SelectVectorButton){
1052 myEditCurrentArgument = (QWidget*)SpinBox_Vx;
1053 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1054 aViewWindow->SetSelectionMode(FaceSelection);
1057 myEditCurrentArgument->setFocus();
1058 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1059 SelectionIntoArgument();
1062 //=================================================================================
1063 // function : DeactivateActiveDialog()
1064 // purpose : Deactivates this dialog
1065 //=================================================================================
1066 void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
1068 if (ConstructorsBox->isEnabled()) {
1069 ConstructorsBox->setEnabled(false);
1070 GroupArguments->setEnabled(false);
1071 GroupButtons->setEnabled(false);
1072 mySMESHGUI->ResetState();
1073 mySMESHGUI->SetActiveDialogBox(0);
1077 //=================================================================================
1078 // function : ActivateThisDialog()
1079 // purpose : Activates this dialog
1080 //=================================================================================
1081 void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
1083 // Emit a signal to deactivate the active dialog
1084 mySMESHGUI->EmitSignalDeactivateDialog();
1085 ConstructorsBox->setEnabled(true);
1086 GroupArguments->setEnabled(true);
1087 GroupButtons->setEnabled(true);
1089 mySMESHGUI->SetActiveDialogBox(this);
1091 ConstructorsClicked(GetConstructorId());
1092 SelectionIntoArgument();
1095 //=================================================================================
1096 // function : enterEvent()
1097 // purpose : Mouse enter event
1098 //=================================================================================
1099 void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
1101 if (!ConstructorsBox->isEnabled())
1102 ActivateThisDialog();
1105 //=================================================================================
1106 // function : onSelectMesh()
1108 //=================================================================================
1109 void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
1112 myIDs = LineEditElements->text();
1113 TextLabelElements->setText(tr("SMESH_NAME"));
1116 TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
1118 myFilterBtn->setEnabled(!toSelectMesh);
1120 if (myEditCurrentArgument != LineEditElements) {
1121 LineEditElements->clear();
1125 mySelectionMgr->clearFilters();
1129 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1130 aViewWindow->SetSelectionMode(ActorSelection);
1131 switch( GetConstructorId() ) {
1132 case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
1133 case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
1134 case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
1136 LineEditElements->setReadOnly(true);
1137 LineEditElements->setValidator(0);
1141 int aConstructorId = GetConstructorId();
1142 switch(aConstructorId) {
1145 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1146 aViewWindow->SetSelectionMode(NodeSelection);
1151 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1152 aViewWindow->SetSelectionMode(EdgeSelection);
1157 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1158 aViewWindow->SetSelectionMode(FaceSelection);
1162 LineEditElements->setReadOnly(false);
1163 LineEditElements->setValidator(myIdValidator);
1164 onTextChange(LineEditElements->text());
1167 SelectionIntoArgument();
1170 LineEditElements->setText( myIDs );
1173 //=================================================================================
1174 // function : GetConstructorId()
1176 //=================================================================================
1177 int SMESHGUI_ExtrusionDlg::GetConstructorId()
1179 return GroupConstructors->checkedId();
1182 //=================================================================================
1183 // function : keyPressEvent()
1185 //=================================================================================
1186 void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
1188 QDialog::keyPressEvent( e );
1189 if ( e->isAccepted() )
1192 if ( e->key() == Qt::Key_F1 ) {
1198 //=================================================================================
1199 // function : setFilters()
1200 // purpose : SLOT. Called when "Filter" button pressed.
1201 //=================================================================================
1202 void SMESHGUI_ExtrusionDlg::setFilters()
1204 if(myMesh->_is_nil()) {
1205 SUIT_MessageBox::critical(this,
1207 tr("NO_MESH_SELECTED"));
1213 types.append( SMESH::NODE );
1214 types.append( SMESH::EDGE );
1215 types.append( SMESH::FACE );
1216 myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
1218 switch( GetConstructorId() ){
1221 myFilterDlg->Init( SMESH::NODE );
1226 myFilterDlg->Init( SMESH::EDGE );
1231 myFilterDlg->Init( SMESH::FACE );
1237 myFilterDlg->SetSelection();
1238 myFilterDlg->SetMesh( myMesh );
1239 myFilterDlg->SetSourceWg( LineEditElements );
1241 myFilterDlg->show();
1244 //=================================================================================
1245 // function : isValid
1247 //=================================================================================
1248 bool SMESHGUI_ExtrusionDlg::isValid()
1252 if ( ExtrMethod_RBut0->isChecked() ) {
1253 ok = SpinBox_Dx->isValid( msg, true ) && ok;
1254 ok = SpinBox_Dy->isValid( msg, true ) && ok;
1255 ok = SpinBox_Dz->isValid( msg, true ) && ok;
1256 } else if ( ExtrMethod_RBut1->isChecked() ) {
1257 ok = SpinBox_Vx->isValid( msg, true ) && ok;
1258 ok = SpinBox_Vy->isValid( msg, true ) && ok;
1259 ok = SpinBox_Vz->isValid( msg, true ) && ok;
1260 ok = SpinBox_VDist->isValid( msg, true ) && ok;
1262 ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
1265 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
1266 if ( !msg.isEmpty() )
1268 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
1274 //=================================================================================
1275 // function : onDisplaySimulation
1276 // purpose : Show/Hide preview
1277 //=================================================================================
1278 void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
1280 if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
1281 if (myNbOkElements && isValid() && isValuesValid()) {
1283 SMESH::DirStruct aVector;
1284 getExtrusionVector(aVector);
1286 //Get Number of the steps
1287 long aNbSteps = (long)SpinBox_NbSteps->value();
1290 SUIT_OverrideCursor aWaitCursor;
1291 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
1293 if ( ExtrMethod_RBut2->isVisible() &&
1294 ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
1296 extrusionByNormal( aMeshEditor );
1298 else if ( CheckBoxMesh->isChecked() ) // Extrude the whole object
1300 switch (GetConstructorId()) {
1303 aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps);
1308 aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
1313 aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
1318 else // extrude some elements
1320 if(GetConstructorId() == 0)
1321 aMeshEditor->ExtrusionSweep0D(myElementsId.inout(), aVector, aNbSteps);
1323 aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
1325 SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
1326 mySimulation->SetData(aMeshPreviewStruct._retn());
1338 //=================================================================================
1339 // function : getExtrusionVector()
1340 // purpose : get direction of the extrusion
1341 //=================================================================================
1342 void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector)
1344 if ( ExtrMethod_RBut0->isChecked() )
1346 aVector.PS.x = SpinBox_Dx->GetValue();
1347 aVector.PS.y = SpinBox_Dy->GetValue();
1348 aVector.PS.z = SpinBox_Dz->GetValue();
1350 else if ( ExtrMethod_RBut1->isChecked() )
1352 gp_XYZ aNormale(SpinBox_Vx->GetValue(),
1353 SpinBox_Vy->GetValue(),
1354 SpinBox_Vz->GetValue());
1355 aNormale /= aNormale.Modulus();
1356 double aVDist = (double)SpinBox_VDist->value();
1358 aVector.PS.x = aNormale.X()*aVDist;
1359 aVector.PS.y = aNormale.Y()*aVDist;
1360 aVector.PS.z = aNormale.Z()*aVDist;
1364 //=======================================================================
1365 //function : extrusionByNormal
1366 //purpose : performs extrusion by normal
1367 //=======================================================================
1369 void SMESHGUI_ExtrusionDlg::extrusionByNormal( SMESH::SMESH_MeshEditor_ptr meshEditor,
1370 const bool makeGroups)
1372 SMESH::SMESH_IDSource_wrap anIDSource;
1373 if ( CheckBoxMesh->isChecked() )
1375 anIDSource = mySelectedObject;
1376 anIDSource->Register();
1378 else // make a temporary id source
1380 anIDSource = meshEditor->MakeIDSource( myElementsId, SMESH::ALL );
1383 double stepSize = (double) SpinBox_VDist->value();
1384 long nbSteps = (long)SpinBox_NbSteps->value();
1385 bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
1386 bool byAverageNormal = ByAverageNormalCheck->isChecked();
1387 int dim = GetConstructorId();
1389 SMESH::ListOfGroups_var groups =
1390 meshEditor->ExtrusionByNormal( anIDSource, stepSize, nbSteps,
1391 useInputElemsOnly, byAverageNormal, makeGroups, dim );