1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // GEOM GEOMGUI : GUI for Geometry component
21 // File : EntityGUI_3DSketcherDlg.cxx
24 #include "EntityGUI_3DSketcherDlg.h"
25 #include "EntityGUI_Widgets.h"
26 #include <SalomeApp_DoubleSpinBox.h>
29 #include <GeometryGUI.h>
30 #include <GEOMImpl_Types.hxx>
31 #include <Precision.hxx>
34 #include <SUIT_Desktop.h>
35 #include <SUIT_Session.h>
36 #include <SUIT_MessageBox.h>
37 #include <SUIT_ResourceMgr.h>
38 #include <SalomeApp_Application.h>
39 #include <LightApp_Application.h>
40 #include <LightApp_SelectionMgr.h>
42 #include <BRep_Tool.hxx>
44 #include <TopExp_Explorer.hxx>
45 #include <TopoDS_Vertex.hxx>
47 #include <TColStd_IndexedMapOfInteger.hxx>
48 #include <BRepBuilderAPI_Transform.hxx>
49 #include <BRepBuilderAPI_MakeWire.hxx>
54 Locker( bool& l ) : myLock( l ) { myLock = true; }
55 ~Locker() { myLock = false; }
60 //=================================================================================
61 // class : EntityGUI_3DSketcherDlg()
62 // purpose : Constructs a EntityGUI_3DSketcherDlg which is a child of 'parent', with the
63 // name 'name' and widget flags set to 'f'.
64 // The dialog will by default be modeless, unless you set 'modal' to
65 // TRUE to construct a modal dialog.
66 //=================================================================================
67 EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
68 bool modal, Qt::WindowFlags fl,
69 const double lineWidth )
70 : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
73 myLineWidth( lineWidth ),
74 myGeometryGUI( theGeometryGUI )
76 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
77 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
78 QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
79 QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_3DSKETCH" ) ) );
81 setWindowTitle( tr( "GEOM_3DSKETCHER_TITLE" ) );
83 /***************************************************************/
85 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_3DSKETCHER" ) );
86 mainFrame()->RadioButton1->setIcon( image3 );;
87 mainFrame()->RadioButton2->close();
88 mainFrame()->RadioButton3->close();
90 GroupType = new DlgRef_3Radio(centralWidget());
91 GroupType->GroupBox1->setTitle(tr("GEOM_COORDINATES_TYPE"));
92 GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS"));
93 GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
94 GroupType->RadioButton3->close();
95 myTypeGroup = new QButtonGroup( this );
96 myTypeGroup->addButton( GroupType->RadioButton1, 0 );
97 myTypeGroup->addButton( GroupType->RadioButton2, 1 );
99 Group3Spin = new EntityGUI_3Spin( centralWidget() );
100 Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
101 Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
102 Group3Spin->buttonUndo->setIcon( image1 );
103 Group3Spin->buttonRedo->setIcon( image2 );
104 Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
105 Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
106 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
108 buttonOk()->setText( tr( "GEOM_BUT_END_SKETCH" ) );
109 buttonApply()->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
111 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
112 layout->setMargin( 0 ); layout->setSpacing( 6 );
113 layout->addWidget( GroupType );
114 layout->addWidget( Group3Spin );
116 setHelpFileName( "create_3dsketcher_page.html" );
124 //=================================================================================
125 // function : ~EntityGUI_3DSketcherDlg()
126 // purpose : Destroys the object and frees any allocated resources
127 //=================================================================================
128 EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg()
130 myGeomGUI->SetActiveDialogBox( 0 );
133 //=================================================================================
136 //=================================================================================
137 void EntityGUI_3DSketcherDlg::Init()
141 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
143 /* Get setting of step value from file configuration */
144 double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
146 /* min, max, step and decimals for spin boxes */
147 initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
148 initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
149 initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
151 Group3Spin->SpinBox_DX->setValue(0.0);
152 Group3Spin->SpinBox_DY->setValue(0.0);
153 Group3Spin->SpinBox_DZ->setValue(0.0);
155 /* signals and slots connections */
156 connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
157 connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
159 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
161 connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
162 connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
163 connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
165 connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) );
167 connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
168 connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
169 connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
171 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
173 connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
174 connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
176 initName( tr( "GEOM_3DSKETCHER" ) );
178 UpdateButtonsState();
179 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
182 //=================================================================================
183 // function : TypeClicked()
184 // purpose : Radio button management
185 //=================================================================================
186 void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
188 if ( mode == myMode ) return;
190 bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
191 Group3Spin->SpinBox_DX->blockSignals(true);
192 Group3Spin->SpinBox_DY->blockSignals(true);
193 Group3Spin->SpinBox_DZ->blockSignals(true);
194 // Get setting of step value from file configuration
195 XYZ xyz = getLastPoint();
197 Group3Spin->SpinBox_DX->text().toDouble( &okx );
198 Group3Spin->SpinBox_DY->text().toDouble( &oky );
199 Group3Spin->SpinBox_DZ->text().toDouble( &okz );
200 if ( mode == 0 ) { // XY
201 Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
202 Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
203 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
204 if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() );
205 if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() );
206 if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
207 Group3Spin->buttonApply->setFocus();
210 Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
211 Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
212 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
213 if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x );
214 if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y );
215 if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
216 Group3Spin->buttonApply->setFocus();
218 Group3Spin->SpinBox_DX->blockSignals(blocked);
219 Group3Spin->SpinBox_DY->blockSignals(blocked);
220 Group3Spin->SpinBox_DZ->blockSignals(blocked);
225 //=================================================================================
226 // function : ClickOnAddPoint()
227 // purpose : called when the point coordinates is Applyed
228 //=================================================================================
229 void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
232 if ( !isValid( msg ) ) {
237 myPointsList.append( getCurrentPoint() );
241 Group3Spin->SpinBox_DX->setValue( 0.0 );
242 Group3Spin->SpinBox_DY->setValue( 0.0 );
243 Group3Spin->SpinBox_DZ->setValue( 0.0 );
245 UpdateButtonsState();
246 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
249 //=================================================================================
250 // function : UpdateButtonsState()
252 //=================================================================================
253 void EntityGUI_3DSketcherDlg::UpdateButtonsState()
255 if ( myPointsList.count() == 0 ) GroupType->RadioButton1->click();
256 GroupType->RadioButton2->setEnabled( myPointsList.count() > 0 );
257 Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 0 );
258 Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 0 );
261 //=================================================================================
262 // function : ClickOnUndo()
264 //=================================================================================
265 void EntityGUI_3DSketcherDlg::ClickOnUndo()
267 if (myPointsList.count() > 0) {
268 myRedoList.append( myPointsList.takeLast() );
269 UpdateButtonsState();
270 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
274 //=================================================================================
275 // function : ClickOnRedo()
277 //=================================================================================
278 void EntityGUI_3DSketcherDlg::ClickOnRedo()
280 if ( myRedoList.count() > 0) {
281 myPointsList.append( myRedoList.takeLast() );
282 UpdateButtonsState();
283 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
287 //=================================================================================
288 // function : SelectionIntoArgument()
289 // purpose : Called when selection as changed
290 //=================================================================================
291 void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
293 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
294 SALOME_ListIO aSelList;
295 aSelMgr->selectedObjects(aSelList);
297 int nbSel = aSelList.Extent();
299 Standard_Boolean aRes = Standard_False;
300 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
301 if (!CORBA::is_nil(aSelectedObject) && aRes) {
303 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection
304 TColStd_IndexedMapOfInteger aMap;
305 aSelMgr->GetIndexes(aSelList.First(), aMap);
306 if (aMap.Extent() == 1)
308 int anIndex = aMap(1);
309 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
310 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
314 if ( aShape.ShapeType() != TopAbs_VERTEX )
315 isOk = GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX);
318 if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
319 // set coordinates to the Spin Boxes
324 bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
325 Group3Spin->SpinBox_DX->blockSignals(true);
326 Group3Spin->SpinBox_DY->blockSignals(true);
327 Group3Spin->SpinBox_DZ->blockSignals(true);
328 if ( GroupType->RadioButton1->isChecked() ) {
329 Group3Spin->SpinBox_DX->setValue( aX );
330 Group3Spin->SpinBox_DY->setValue( aY );
331 Group3Spin->SpinBox_DZ->setValue( aZ );
332 } else if ( GroupType->RadioButton2->isChecked() ) {
333 XYZ xyz = getLastPoint();
334 Group3Spin->SpinBox_DX->setValue( aX - xyz.x );
335 Group3Spin->SpinBox_DY->setValue( aY - xyz.y );
336 Group3Spin->SpinBox_DZ->setValue( aZ - xyz.z );
338 Group3Spin->SpinBox_DX->blockSignals(blocked);
339 Group3Spin->SpinBox_DY->blockSignals(blocked);
340 Group3Spin->SpinBox_DZ->blockSignals(blocked);
345 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
348 //=================================================================================
349 // function : DeactivateActiveDialog()
351 //=================================================================================
352 void EntityGUI_3DSketcherDlg::DeactivateActiveDialog()
356 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
357 myGeomGUI->SetActiveDialogBox( 0 );
361 //=================================================================================
362 // function : ActivateThisDialog()
364 //=================================================================================
365 void EntityGUI_3DSketcherDlg::ActivateThisDialog()
367 myGeomGUI->EmitSignalDeactivateDialog();
369 myGeomGUI->SetActiveDialogBox( this );
371 connect( myGeomGUI->getApp()->selectionMgr(),
372 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
374 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
375 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
379 //=================================================================================
380 // function : ValueChangedInSpinBox()
382 //=================================================================================
383 void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue )
385 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
388 //=================================================================================
389 // function : enterEvent()
391 //=================================================================================
392 void EntityGUI_3DSketcherDlg::enterEvent( QEvent* )
394 if ( !mainFrame()->GroupConstructors->isEnabled() )
395 ActivateThisDialog();
398 //=================================================================================
399 // function : createOperation
401 //=================================================================================
402 GEOM::GEOM_IOperations_ptr EntityGUI_3DSketcherDlg::createOperation()
404 return getGeomEngine()->GetICurvesOperations( getStudyId() );
407 //=================================================================================
408 // function : isValid
410 //=================================================================================
411 bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
414 ok = Group3Spin->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
415 ok = Group3Spin->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
416 ok = Group3Spin->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
420 //=================================================================================
421 // function : execute
423 //=================================================================================
424 bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
426 GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
427 if (!myOK || myPointsList.size() == 0)
428 aCoordsArray->length((myPointsList.size()+1)*3);
430 aCoordsArray->length(myPointsList.size()*3);
432 QStringList aParameters;
435 QList<XYZ>::const_iterator it;
436 for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
437 aCoordsArray[i++] = (*it).x;
438 aCoordsArray[i++] = (*it).y;
439 aCoordsArray[i++] = (*it).z;
440 aParameters << (*it).xt;
441 aParameters << (*it).yt;
442 aParameters << (*it).zt;
445 if (!myOK || myPointsList.size() == 0) {
446 XYZ xyz = getCurrentPoint();
447 aCoordsArray[i++] = xyz.x;
448 aCoordsArray[i++] = xyz.y;
449 aCoordsArray[i++] = xyz.z;
450 aParameters << xyz.xt;
451 aParameters << xyz.yt;
452 aParameters << xyz.zt;
455 GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
456 GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray );
458 if ( !anObj->_is_nil() ) {
459 if ( !IsPreview() ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
460 objects.push_back( anObj._retn() );
466 //=================================================================================
467 // function : SetDoubleSpinBoxStep()
468 // purpose : Double spin box management
469 //=================================================================================
470 void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep( double step )
472 Group3Spin->SpinBox_DX->setSingleStep(step);
473 Group3Spin->SpinBox_DY->setSingleStep(step);
474 Group3Spin->SpinBox_DZ->setSingleStep(step);
477 //=================================================================================
478 // function : ClickOnOk()
480 //=================================================================================
481 void EntityGUI_3DSketcherDlg::ClickOnOk()
491 //=================================================================================
492 // function : ClickOnApply()
494 //=================================================================================
495 bool EntityGUI_3DSketcherDlg::ClickOnApply()
498 if ( !isValid( msg ) ) {
503 if (myPointsList.count() > 0)
504 myPointsList.append(myPointsList[0]);
515 //=================================================================================
516 // function : getLastPoint()
517 // purpose : return last points from list
518 //=================================================================================
519 EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getLastPoint() const
521 return myPointsList.count() > 0 ? myPointsList.last() : XYZ();
524 //=================================================================================
525 // function : getCurrentPoint()
526 // purpose : returns current points
527 //=================================================================================
528 EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const
532 xyz.x = Group3Spin->SpinBox_DX->value();
533 xyz.y = Group3Spin->SpinBox_DY->value();
534 xyz.z = Group3Spin->SpinBox_DZ->value();
537 xyz = getLastPoint();
538 xyz.x += Group3Spin->SpinBox_DX->value();
539 xyz.y += Group3Spin->SpinBox_DY->value();
540 xyz.z += Group3Spin->SpinBox_DZ->value();
542 xyz.xt = Group3Spin->SpinBox_DX->text();
543 xyz.yt = Group3Spin->SpinBox_DY->text();
544 xyz.zt = Group3Spin->SpinBox_DZ->text();
548 //================================================================
549 // Function : displayPreview
550 // Purpose : Method for displaying preview of resulting shape
551 // Redefined from GEOMBase_Helper.
552 //================================================================
553 void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
557 const double lineWidth,
558 const int displayMode,
561 // Set color for preview shape
562 getDisplayer()->SetColor( Quantity_NOC_RED );
564 // set width of displayed shape
565 getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth );
567 // Disable activation of selection
568 getDisplayer()->SetToActivate( activate );
570 // Make a reference to GEOM_Object
571 CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
572 getDisplayer()->SetName( objStr.in() );
574 // Create wire from applied object
575 TopoDS_Shape anApplyedWire, aLastSegment;
576 if ( !createShapes( object, anApplyedWire, aLastSegment ) )
580 SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
581 if ( aPrs != 0 && !aPrs->IsNull() )
582 GEOMBase_Helper::displayPreview( aPrs, append, update );
584 getDisplayer()->SetColor( Quantity_NOC_VIOLET );
585 aPrs = getDisplayer()->BuildPrs( aLastSegment );
586 if ( aPrs != 0 && !aPrs->IsNull() )
587 GEOMBase_Helper::displayPreview( aPrs, append, update );
589 getDisplayer()->UnsetName();
591 // Enable activation of displayed objects
592 getDisplayer()->SetToActivate( true );
595 //================================================================
596 // Function : createShapes
597 // Purpose : Create applyed wire, and last segment from entry object
598 //================================================================
599 bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
600 TopoDS_Shape& theApplyedWire,
601 TopoDS_Shape& theLastSegment )
604 if ( !GEOMBase::GetShape( theObject, aShape ) ||
605 aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
608 theApplyedWire = aShape;
612 BRepBuilderAPI_MakeWire aBuilder;
613 TopExp_Explorer edgeExp( aShape, TopAbs_EDGE );
615 TopoDS_Shape anEdge = edgeExp.Current();
617 if ( edgeExp.More() ) // i.e. non-last edge
618 aBuilder.Add( TopoDS::Edge( anEdge ) );
620 theLastSegment = anEdge;
625 if ( aBuilder.IsDone() ) {
626 theApplyedWire = aBuilder.Shape();
628 else if ( !theLastSegment.IsNull() ) {
629 TopExp_Explorer vertexExp( theLastSegment, TopAbs_VERTEX );
630 theApplyedWire = vertexExp.Current();