From 98589fc17cc9a632b567e9e0aad1d126f222a401 Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 16 Nov 2007 10:03:51 +0000 Subject: [PATCH] NPAL 16548, 16820, 16218, 16547 --- Makefile.in | 2 + idl/GEOM_Gen.idl | 27 +++ idl/GEOM_Superv.idl | 11 ++ resources/line2faces.png | Bin 0 -> 809 bytes resources/point_line_intersection.png | Bin 0 -> 572 bytes src/BasicGUI/BasicGUI_ArcDlg.cxx | 9 +- src/BasicGUI/BasicGUI_LineDlg.cxx | 105 ++++++++++- src/BasicGUI/BasicGUI_LineDlg.h | 5 +- src/BasicGUI/BasicGUI_PointDlg.cxx | 78 +++++++- src/BasicGUI/BasicGUI_PointDlg.h | 4 + src/DlgRef/DlgRef_3Sel1Check_QTD.cxx | 24 +-- src/DlgRef/DlgRef_3Sel1Check_QTD.h | 8 +- src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui | 28 +-- src/DlgRef/UIFiles/ui_to_cxx | 7 +- src/GEOMContext/GEOM_icons.po | 8 + src/GEOMContext/GEOM_msg_en.po | 16 ++ src/GEOMGUI/GEOM_images.po | 8 + src/GEOMGUI/GEOM_msg_en.po | 21 ++- src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx | 178 +++++++++++++++++++ src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx | 11 ++ src/GEOMImpl/GEOMImpl_IBasicOperations.cxx | 108 +++++++++++ src/GEOMImpl/GEOMImpl_IBasicOperations.hxx | 6 + src/GEOMImpl/GEOMImpl_ILine.hxx | 10 +- src/GEOMImpl/GEOMImpl_IPoint.hxx | 6 + src/GEOMImpl/GEOMImpl_LineDriver.cxx | 38 +++- src/GEOMImpl/GEOMImpl_PointDriver.cxx | 32 +++- src/GEOMImpl/GEOMImpl_PrismDriver.cxx | 41 ++++- src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx | 17 +- src/GEOMImpl/GEOMImpl_Types.hxx | 23 ++- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 13 +- src/GEOM_I/GEOM_I3DPrimOperations_i.cc | 104 +++++++++++ src/GEOM_I/GEOM_I3DPrimOperations_i.hh | 12 ++ src/GEOM_I/GEOM_IBasicOperations_i.cc | 65 +++++++ src/GEOM_I/GEOM_IBasicOperations_i.hh | 6 + src/GEOM_I_Superv/GEOM_Superv_i.cc | 72 ++++++++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 13 ++ src/GEOM_SWIG/batchmode_geompy.py | 18 ++ src/GEOM_SWIG/geompy.py | 24 +++ src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 54 ++++-- src/GenerationGUI/GenerationGUI_PrismDlg.h | 8 +- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 24 ++- src/GenerationGUI/GenerationGUI_RevolDlg.h | 2 + src/GroupGUI/GroupGUI_GroupDlg.cxx | 12 +- 43 files changed, 1164 insertions(+), 94 deletions(-) create mode 100755 resources/line2faces.png create mode 100755 resources/point_line_intersection.png diff --git a/Makefile.in b/Makefile.in index 4359b01f2..956dd5092 100644 --- a/Makefile.in +++ b/Makefile.in @@ -94,6 +94,7 @@ fuse.png \ geometry.png \ line.png \ line2points.png \ +line2faces.png \ lineedge.png \ linepointvector.png \ mindist.png \ @@ -126,6 +127,7 @@ planeworkingvector.png \ planeworkingorigin.png \ point2.png \ pointonedge.png \ +point_line_intersection.png \ polyline.png \ prism.png \ prism2.png \ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index fa99c0db3..e5c82d5ce 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -264,6 +264,13 @@ module GEOM GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, in double theParameter); + /*! + * Create a point, on two lines intersection. + * \param theRefLine1, theRefLine2 The referenced lines. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnLinesIntersection (in GEOM_Object theRefLine1, + in GEOM_Object theRefLine2); /*! * Create a vector, corresponding to tangent to the given parameter on the given curve. @@ -312,6 +319,14 @@ module GEOM */ GEOM_Object MakeLineTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2); + /*! + * Create a line, given by two faces intersection. + * \param theFace1 First of two faces, defining the line. + * \param theFace2 Second of two faces, defining the line. + * \return New GEOM_Object, containing the created line. + */ + GEOM_Object MakeLineTwoFaces (in GEOM_Object theFace1, in GEOM_Object theFace2); + /*! * Create a plane, passing through the three given points * \param thePnt1 First of three points, defining the plane. @@ -806,6 +821,10 @@ module GEOM GEOM_Object MakePrismVecH (in GEOM_Object theBase, in GEOM_Object theVec, in double theH); + /* The Same Prism but in 2 directions (forward&backward) */ + GEOM_Object MakePrismVecH2Ways (in GEOM_Object theBase, + in GEOM_Object theVec, + in double theH); /*! * Create a shape by extrusion of the base shape along a vector, defined by two points. @@ -817,6 +836,10 @@ module GEOM GEOM_Object MakePrismTwoPnt (in GEOM_Object theBase, in GEOM_Object thePoint1, in GEOM_Object thePoint2); + /* The same prism but in two directions forward&backward */ + GEOM_Object MakePrismTwoPnt2Ways (in GEOM_Object theBase, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2); /*! * Create a shape by extrusion of the base shape along @@ -839,6 +862,10 @@ module GEOM GEOM_Object MakeRevolutionAxisAngle (in GEOM_Object theBase, in GEOM_Object theAxis, in double theAngle); + /* The Same Revolution but in both ways forward&backward */ + GEOM_Object MakeRevolutionAxisAngle2Ways (in GEOM_Object theBase, + in GEOM_Object theAxis, + in double theAngle); /*! * Create a filling from the given compound of contours. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index e217d4077..dcaecd95f 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -83,6 +83,8 @@ module GEOM in GEOM_Object thePnt2) ; GEOM_Object MakeLineTwoPnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2) ; + GEOM_Object MakeLineTwoFaces (in GEOM_Object theFace1, + in GEOM_Object theFace2) ; GEOM_Object MakePlaneThreePnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2, in GEOM_Object thePnt3, @@ -154,14 +156,23 @@ module GEOM GEOM_Object MakePrismVecH (in GEOM_Object theBase, in GEOM_Object theVec, in double theH) ; + GEOM_Object MakePrismVecH2Ways (in GEOM_Object theBase, + in GEOM_Object theVec, + in double theH) ; GEOM_Object MakePrismTwoPnt (in GEOM_Object theBase, in GEOM_Object thePoint1, in GEOM_Object thePoint2) ; + GEOM_Object MakePrismTwoPnt2Ways (in GEOM_Object theBase, + in GEOM_Object thePoint1, + in GEOM_Object thePoint2) ; GEOM_Object MakePipe (in GEOM_Object theBase, in GEOM_Object thePath) ; GEOM_Object MakeRevolutionAxisAngle (in GEOM_Object theBase, in GEOM_Object theAxis, in double theAngle) ; + GEOM_Object MakeRevolutionAxisAngle2Ways (in GEOM_Object theBase, + in GEOM_Object theAxis, + in double theAngle) ; GEOM_Object MakeFilling (in GEOM_Object theShape, in long theMinDeg, in long theMaxDeg, in double theTol2D, in double theTol3D, diff --git a/resources/line2faces.png b/resources/line2faces.png new file mode 100755 index 0000000000000000000000000000000000000000..89c9d26ed9061a4e03a7a5af5cf183c7885381fc GIT binary patch literal 809 zcmV+^1J?YBP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;pGibPRCwBAU?2i0D=YtJAQAus5ECH<*4EblfdIr5 z0Adb8>Hz`>uYtb4zW?oOmNWeM^9RJ$gc^z$00a^yw2=KR^Is82Iz&PX>XTn;GuNc{6Ohy^>zlw zPDTcH7A6K3CPoHOq=PK|0+g5j_Lbq+*G~-F^6fy{6#)VW#Xv7Fum7Jve`dHV>&fu- zC&(~IhLmNyfUfz&z{to1#K5rp5AwwyhCe@m27UR!@Ed5@zJ?Hx_9P&-1PCCwfws1` z{|$0yFl?*zWB39#%$^}>(N2cn-#;+?{q=+4AJCBh|Nb)k`|}IP{|Pqm_xCRh$0uZg zv^N8>BoN;R2p~ofPfJVdziazeU=m?q*pO?>aOEKbL*l~i3_m};WBB>yJ;U#BpCN|+ z{s}hh?{5gcu&@zk*bk6lKztq`fEWb@1;IH16d9m^e)5T%L6G?sv5|^m7!W@I2p~pi z`T`|dLr|asajR$Feuf_(Ujy+QFnxZ0Jxnt?Krsx&2M8b*sDXk|12w5{W01!ZoSj7J03UES(fdD`N;VNyC$T18A00Ib`fr{iB1_A&9 ngsm9ifCj~VQVjzEfB*vkJi|1S?((ux00000NkvXXu0mjf{Jcm@ literal 0 HcmV?d00001 diff --git a/resources/point_line_intersection.png b/resources/point_line_intersection.png new file mode 100755 index 0000000000000000000000000000000000000000..31f6c194411376d873fb0a54e067f1d142bc2d37 GIT binary patch literal 572 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!<|{Ln>}1{rUgjp4pVqfx*x)K$3w)fcZr0lO3Oo#jn@rq%pDx2rIho;Mu%k zRnyAn4%3)96n1bsPTF-a`d@Nr3)`01sDxKCjSrVj+_OGb0nnO$WvmDPmUwIAz)j9dvnGl0?LrSOmJbCyF}pKCSpY^}GG7L@tLM zhEVOsH^LJv85oanbSJvGxy@L}6u`sP^m%`rvGIn^f2j}te)ARZe8()XpW)Tt#wFr8 z3Jwelr8$@trq{ZE-(>JT-MQrO1zr{og&5A?>;anh9T8`Lr|vN2qb4=~`66>S8@G=rzBpUXO@ GgeCxVPQoex literal 0 HcmV?d00001 diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 86ea68832..11052a67d 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -34,6 +34,7 @@ #include "LightApp_SelectionMgr.h" #include +#include #include "GEOMImpl_Types.hxx" @@ -93,7 +94,7 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, Group3Pnts2->PushButton2->setPixmap(image2); Group3Pnts2->PushButton3->setPixmap(image2); - Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE")); + Group3Pnts2->CheckButton1->setText(tr("GEOM_REVERSE")); Layout1->addWidget( Group3Pnts, 2, 0 ); Layout1->addWidget( Group3Pnts2, 2, 0 ); @@ -123,7 +124,7 @@ void BasicGUI_ArcDlg::Init() /* init variables */ myEditCurrentArgument = Group3Pnts->LineEdit1; myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - Group3Pnts2->radioButton4->setChecked(FALSE); + Group3Pnts2->CheckButton1->setChecked(FALSE); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -151,7 +152,7 @@ void BasicGUI_ArcDlg::Init() connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); + connect(Group3Pnts2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -427,7 +428,7 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects ) case 1: { bool Sense; - (Group3Pnts2->radioButton4->isChecked()) ? Sense = true : Sense = false; + (Group3Pnts2->CheckButton1->isChecked()) ? Sense = true : Sense = false; if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ) { anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())-> diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index f71fc7a18..117c519f0 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -55,26 +55,39 @@ BasicGUI_LineDlg::BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent, { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2F"))); setCaption(tr("GEOM_LINE_TITLE")); + QGroupBox* aFrame = new QGroupBox( 1, Qt::Horizontal, this ); + aFrame->setInsideMargin( 0 ); + aFrame->setFrameStyle( QFrame::NoFrame ); + /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_LINE")); RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); + RadioButton2->setPixmap(image2); RadioButton3->close(TRUE); - GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints = new DlgRef_2Sel_QTD( aFrame, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton2->setPixmap(image1); - GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - Layout1->addWidget(GroupPoints, 2, 0); + GroupFaces = new DlgRef_2Sel_QTD( aFrame, "GroupFaces"); + GroupFaces->GroupBox1->setTitle(tr("GEOM_FACES")); + GroupFaces->TextLabel1->setText(tr("GEOM_FACE_I").arg("1")); + GroupFaces->TextLabel2->setText(tr("GEOM_FACE_I").arg("2")); + GroupFaces->PushButton1->setPixmap(image1); + GroupFaces->PushButton2->setPixmap(image1); + GroupFaces->LineEdit1->setReadOnly( true ); + GroupFaces->LineEdit2->setReadOnly( true ); + + Layout1->addWidget(aFrame, 2, 0); /***************************************************************/ setHelpFileName("line.htm"); @@ -110,19 +123,25 @@ void BasicGUI_LineDlg::Init() connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFaces->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFaces->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFaces->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFaces->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + ConstructorsClicked (0); initName( tr("GEOM_LINE") ); } @@ -159,6 +178,44 @@ bool BasicGUI_LineDlg::ClickOnApply() return true; } +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_LineDlg::ConstructorsClicked(int constructorId) +{ + switch ( constructorId ) + { + case 0: + { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument->setText(""); + myPoint1 = GEOM::GEOM_Object::_nil(); + myPoint2 = GEOM::GEOM_Object::_nil(); + globalSelection( GEOM_POINT ); + GroupPoints->show(); + GroupFaces->hide(); + break; + } + case 1: + { + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + myEditCurrentArgument = GroupFaces->LineEdit1; + myEditCurrentArgument->setText(""); + myFace1 = GEOM::GEOM_Object::_nil(); + myFace2 = GEOM::GEOM_Object::_nil(); + globalSelection( GEOM_FACE ); + GroupPoints->hide(); + GroupFaces->show(); + break; + } + } + + updateGeometry(); + resize( minimumSize() ); + SelectionIntoArgument(); +} //================================================================================= // function : SelectionIntoArgument() @@ -172,6 +229,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument() { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil(); return; } @@ -183,6 +242,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument() myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; + else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = aSelectedObject; + else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = aSelectedObject; } displayPreview(); @@ -198,6 +259,8 @@ void BasicGUI_LineDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + else if ( send == GroupFaces->PushButton1 ) myEditCurrentArgument = GroupFaces->LineEdit1; + else if ( send == GroupFaces->PushButton2 ) myEditCurrentArgument = GroupFaces->LineEdit2; myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -212,6 +275,8 @@ void BasicGUI_LineDlg::LineEditReturnPressed() QLineEdit* send = (QLineEdit*)sender(); if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1; else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + else if ( send == GroupFaces->LineEdit1 ) myEditCurrentArgument = GroupFaces->LineEdit1; + else if ( send == GroupFaces->LineEdit2 ) myEditCurrentArgument = GroupFaces->LineEdit2; else return; GEOMBase_Skeleton::LineEditReturnPressed(); } @@ -235,7 +300,9 @@ void BasicGUI_LineDlg::ActivateThisDialog() GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); - myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); + GroupFaces->LineEdit1->setText( "" ); + GroupFaces->LineEdit2->setText( "" ); + myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); } //================================================================================= @@ -273,7 +340,12 @@ GEOM::GEOM_IOperations_ptr BasicGUI_LineDlg::createOperation() //================================================================================= bool BasicGUI_LineDlg::isValid( QString& msg ) { - return !myPoint1->_is_nil() && !myPoint2->_is_nil(); + const int id = getConstructorId(); + if ( id == 0 ) + return !myPoint1->_is_nil() && !myPoint2->_is_nil(); + else if ( id == 1 ) + return !myFace1->_is_nil() && !myFace2->_is_nil(); + return false; } //================================================================================= @@ -282,10 +354,27 @@ bool BasicGUI_LineDlg::isValid( QString& msg ) //================================================================================= bool BasicGUI_LineDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 ); + bool res = false; + GEOM::GEOM_Object_var anObj; + switch ( getConstructorId() ) + { + case 0 : + { + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 ); + res = true; + break; + } + case 1 : + { + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoFaces( myFace1, myFace2 ); + res = true; + break; + } + } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - return true; + + return res; } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_LineDlg.h b/src/BasicGUI/BasicGUI_LineDlg.h index 64fea7f1c..ef0f2bd37 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.h +++ b/src/BasicGUI/BasicGUI_LineDlg.h @@ -64,8 +64,11 @@ private : GEOM::GEOM_Object_var myPoint1; GEOM::GEOM_Object_var myPoint2; + GEOM::GEOM_Object_var myFace1; + GEOM::GEOM_Object_var myFace2; DlgRef_2Sel_QTD* GroupPoints; + DlgRef_2Sel_QTD* GroupFaces; private slots: void ClickOnOk(); @@ -74,7 +77,7 @@ private slots: void ActivateThisDialog(); void DeactivateActiveDialog(); - + void ConstructorsClicked(int constructorId); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 755a04b9b..93d2fb470 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -65,6 +65,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE"))); QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); + QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_LINES"))); setCaption(tr("GEOM_POINT_TITLE")); @@ -77,6 +78,8 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren RadioButton1->setPixmap(image0); RadioButton2->setPixmap(image3); RadioButton3->setPixmap(image1); + RadioButton4->show(); + RadioButton4->setPixmap(image4); GroupXYZ = new DlgRef_3Spin( aFrame, "GroupXYZ" ); GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES")); @@ -98,6 +101,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren GroupRefPoint->TextLabel3->setText(tr("GEOM_DY")); GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ")); + GroupLineIntersection = new DlgRef_2Sel_QTD (aFrame, "GroupLineIntersection"); + GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION")); + GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1")); + GroupLineIntersection->PushButton1->setPixmap(image2); + GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2")); + GroupLineIntersection->PushButton2->setPixmap(image2); + Layout1->addWidget( aFrame, 2, 0 ); /***************************************************************/ @@ -146,6 +156,8 @@ void BasicGUI_PointDlg::Init() { GroupOnCurve->LineEdit1->setReadOnly( true ); GroupRefPoint->LineEdit1->setReadOnly( true ); + GroupLineIntersection->LineEdit1->setReadOnly( true ); + GroupLineIntersection->LineEdit2->setReadOnly( true ); myEdge = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil(); @@ -186,6 +198,10 @@ void BasicGUI_PointDlg::Init() connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupOnCurve->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupLineIntersection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupLineIntersection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupLineIntersection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupLineIntersection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); @@ -226,9 +242,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) GroupRefPoint->hide(); GroupOnCurve->hide(); - + GroupLineIntersection->hide(); GroupXYZ->show(); - myCoordGrp->hide(); break; } @@ -242,9 +257,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) GroupXYZ->hide(); GroupOnCurve->hide(); - GroupRefPoint->show(); - + GroupLineIntersection->hide(); myCoordGrp->show(); break; } @@ -258,12 +272,28 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) GroupXYZ->hide(); GroupRefPoint->hide(); - GroupOnCurve->show(); - + GroupLineIntersection->hide(); myCoordGrp->show(); break; } + case 3: + { + myEditCurrentArgument = GroupLineIntersection->LineEdit1; + GroupLineIntersection->LineEdit1->setText(""); + GroupLineIntersection->LineEdit2->setText(""); + myLine1 = GEOM::GEOM_Object::_nil(); + myLine2 = GEOM::GEOM_Object::_nil(); + + globalSelection( GEOM_EDGE ); + + GroupXYZ->hide(); + GroupRefPoint->hide(); + GroupOnCurve->hide(); + GroupLineIntersection->show(); + myCoordGrp->hide(); + break; + } } myX->setText( "" ); @@ -382,6 +412,17 @@ void BasicGUI_PointDlg::SelectionIntoArgument() myEdge = aSelectedObject; GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); } + else if ( id == 3 ) + { + if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) { + myLine1 = aSelectedObject; + GroupLineIntersection->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } + else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) { + myLine2 = aSelectedObject; + GroupLineIntersection->LineEdit2->setText( GEOMBase::GetName( aSelectedObject ) ); + } + } } } @@ -396,7 +437,8 @@ void BasicGUI_PointDlg::SelectionIntoArgument() void BasicGUI_PointDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 ) + if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 || + send == GroupLineIntersection->LineEdit1 || send == GroupLineIntersection->LineEdit2 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -424,11 +466,24 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; + globalSelection( GEOM_EDGE ); + } + else if ( send == GroupLineIntersection->PushButton1 ) + { + GroupLineIntersection->LineEdit1->setFocus(); + myEditCurrentArgument = GroupLineIntersection->LineEdit1; + + globalSelection( GEOM_EDGE ); + } + else if ( send == GroupLineIntersection->PushButton2 ) + { + GroupLineIntersection->LineEdit2->setFocus(); + myEditCurrentArgument = GroupLineIntersection->LineEdit2; + globalSelection( GEOM_EDGE ); } } - //================================================================================= // function : enterEvent() // purpose : to reactivate this dialog box when mouse enter onto the window @@ -519,6 +574,8 @@ bool BasicGUI_PointDlg::isValid( QString& msg ) return !myRefPoint->_is_nil(); else if ( id == 2 ) return !myEdge->_is_nil(); + else if ( id == 3) + return ( !myLine1->_is_nil() && !myLine2->_is_nil() ); return false; } @@ -560,6 +617,11 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) MakePointOnCurve( myEdge, getParameter() ); res = true; break; + case 3 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> + MakePointOnLinesIntersection( myLine1, myLine2 ); + res = true; + break; } if ( getConstructorId() == 1 || getConstructorId() == 2 ) diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index c47e09112..cb4b02d60 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -31,6 +31,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel1Spin.h" #include "DlgRef_3Spin.h" +#include "DlgRef_2Sel_QTD.h" #include "DlgRef_1Sel3Spin.h" class QLineEdit; @@ -73,10 +74,13 @@ private : GEOM::GEOM_Object_var myEdge; GEOM::GEOM_Object_var myRefPoint; + GEOM::GEOM_Object_var myLine1; + GEOM::GEOM_Object_var myLine2; DlgRef_3Spin* GroupXYZ; DlgRef_1Sel3Spin* GroupRefPoint; DlgRef_1Sel1Spin* GroupOnCurve; + DlgRef_2Sel_QTD* GroupLineIntersection; QGroupBox* myCoordGrp; QLineEdit* myX; diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx index a1442eab4..e30a066a7 100644 --- a/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** -** Form implementation generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui' +** Form implementation generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui' ** -** Created: Wed Feb 21 10:49:18 2007 +** Created: Mon Oct 29 18:14:59 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - GroupBox1Layout->addWidget( LineEdit1, 0, 2 ); + GroupBox1Layout->addMultiCellWidget( LineEdit1, 0, 0, 2, 3 ); TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); @@ -60,7 +60,7 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - GroupBox1Layout->addWidget( LineEdit2, 1, 2 ); + GroupBox1Layout->addMultiCellWidget( LineEdit2, 1, 1, 2, 3 ); TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); @@ -74,22 +74,22 @@ DlgRef_3Sel1Check_QTD::DlgRef_3Sel1Check_QTD( QWidget* parent, const char* name, LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); - GroupBox1Layout->addWidget( LineEdit3, 2, 2 ); + GroupBox1Layout->addMultiCellWidget( LineEdit3, 2, 2, 2, 3 ); TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); GroupBox1Layout->addWidget( TextLabel3, 2, 0 ); + Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding ); + GroupBox1Layout->addItem( Spacer3, 4, 3 ); - radioButton4 = new QRadioButton( GroupBox1, "radioButton4" ); + CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" ); - GroupBox1Layout->addMultiCellWidget( radioButton4, 3, 3, 0, 1 ); - Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupBox1Layout->addItem( Spacer3, 4, 2 ); + GroupBox1Layout->addMultiCellWidget( CheckButton1, 3, 3, 0, 2 ); DlgRef_3Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); languageChange(); - resize( QSize(490, 878).expandedTo(minimumSizeHint()) ); + resize( QSize(403, 441).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // tab order @@ -122,6 +122,6 @@ void DlgRef_3Sel1Check_QTD::languageChange() TextLabel2->setText( tr( "TL2" ) ); PushButton3->setText( QString::null ); TextLabel3->setText( tr( "TL3" ) ); - radioButton4->setText( tr( "radioButton4" ) ); + CheckButton1->setText( tr( "CheckButton1" ) ); } diff --git a/src/DlgRef/DlgRef_3Sel1Check_QTD.h b/src/DlgRef/DlgRef_3Sel1Check_QTD.h index 0498e7b29..67fa9c31d 100644 --- a/src/DlgRef/DlgRef_3Sel1Check_QTD.h +++ b/src/DlgRef/DlgRef_3Sel1Check_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** -** Form interface generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui' +** Form interface generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui' ** -** Created: Wed Feb 21 10:48:39 2007 +** Created: Mon Oct 29 18:14:59 2007 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -21,7 +21,7 @@ class QGroupBox; class QPushButton; class QLineEdit; class QLabel; -class QRadioButton; +class QCheckBox; class DlgRef_3Sel1Check_QTD : public QWidget { @@ -41,7 +41,7 @@ public: QPushButton* PushButton3; QLineEdit* LineEdit3; QLabel* TextLabel3; - QRadioButton* radioButton4; + QCheckBox* CheckButton1; protected: QGridLayout* DlgRef_3Sel1Check_QTDLayout; diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui index 6f9ef127c..b14325d36 100644 --- a/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_3Sel1Check_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 490 - 878 + 403 + 441 @@ -74,7 +74,7 @@ - + LineEdit1 @@ -111,7 +111,7 @@ - + LineEdit2 @@ -148,7 +148,7 @@ - + LineEdit3 @@ -169,15 +169,7 @@ TL3 - - - radioButton4 - - - radioButton4 - - - + Spacer3 @@ -194,6 +186,14 @@ + + + CheckButton1 + + + CheckButton1 + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index 6165851a8..477665ff9 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -105,5 +105,8 @@ #uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui #uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui -uic -o DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui -uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui \ No newline at end of file +#uic -o DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui +#uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui + +uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui +uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui \ No newline at end of file diff --git a/src/GEOMContext/GEOM_icons.po b/src/GEOMContext/GEOM_icons.po index 2af178b9c..770de62ce 100644 --- a/src/GEOMContext/GEOM_icons.po +++ b/src/GEOMContext/GEOM_icons.po @@ -117,6 +117,10 @@ msgstr "conedxyz.png" msgid "ICON_DLG_LINE_2P" msgstr "line2points.png" +#LineDlg +msgid "ICON_DLG_LINE_2F" +msgstr "line2faces.png" + #LineDlg msgid "ICON_DLG_LINE_EDGE" msgstr "lineedge.png" @@ -166,6 +170,10 @@ msgstr "point2.png" msgid "ICON_DLG_POINT_EDGE" msgstr "pointonedge.png" +#PoinDlg +msgid "ICON_DLG_POINT_LINES" +msgstr "point_line_intersection.png" + #ArcDlg msgid "ICON_DLG_ARC" msgstr "arc.png" diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index 9d956d722..6a3bd3ae3 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -310,6 +310,10 @@ msgstr "Points" msgid "GEOM_POINT_I" msgstr "Point %1" +#Face i +msgid "GEOM_FACE_I" +msgstr "Face %1" + #Arguments msgid "GEOM_ARGUMENTS" msgstr "Arguments" @@ -362,6 +366,10 @@ msgstr "Coord. :" msgid "GEOM_REVERSE" msgstr "Reverse" +#Bothway +msgid "GEOM_BOTHWAY" +msgstr "Bothway" + #Reverse U msgid "GEOM_REVERSE_U" msgstr "Reverse U" @@ -633,6 +641,14 @@ msgstr "Faces" msgid "GEOM_LINE" msgstr "Line" +#Line 1 +msgid "GEOM_LINE1" +msgstr "Line 1" + +#Line 2 +msgid "GEOM_LINE2" +msgstr "Line 2" + #Plane msgid "GEOM_PLANE" msgstr "Plane" diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po index 157ec0807..9a93018a8 100644 --- a/src/GEOMGUI/GEOM_images.po +++ b/src/GEOMGUI/GEOM_images.po @@ -121,6 +121,10 @@ msgstr "conedxyz.png" msgid "ICON_DLG_LINE_2P" msgstr "line2points.png" +#LineDlg +msgid "ICON_DLG_LINE_2F" +msgstr "line2faces.png" + #LineDlg msgid "ICON_DLG_LINE_EDGE" msgstr "lineedge.png" @@ -181,6 +185,10 @@ msgstr "point3.png" msgid "ICON_DLG_POINT_EDGE" msgstr "pointonedge.png" +#PoinDlg +msgid "ICON_DLG_POINT_LINES" +msgstr "point_line_intersection.png" + #ArcDlg msgid "ICON_DLG_ARC" msgstr "arc.png" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 722993755..7b0f7dc80 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -235,7 +235,7 @@ msgstr "Warning" #: GeometryGUI.cxx:3854 msgid "GEOM_REALLY_DELETE" -msgstr "Do you really want to delete object(s) ?" +msgstr "Do you really want to delete this %1 object(s): %2" # #============================================================================== @@ -301,6 +301,10 @@ msgstr "Points" msgid "GEOM_POINT_I" msgstr "Point %1" +#Face i +msgid "GEOM_FACE_I" +msgstr "Face %1" + #Arguments msgid "GEOM_ARGUMENTS" msgstr "Arguments" @@ -353,6 +357,10 @@ msgstr "Coord. :" msgid "GEOM_REVERSE" msgstr "Reverse" +#Bothway +msgid "GEOM_BOTHWAY" +msgstr "Bothway" + #Reverse U msgid "GEOM_REVERSE_U" msgstr "Reverse U" @@ -678,6 +686,14 @@ msgstr "Face or LCS" msgid "GEOM_LINE" msgstr "Line" +#Line 1 +msgid "GEOM_LINE1" +msgstr "Line 1" + +#Line 2 +msgid "GEOM_LINE2" +msgstr "Line 2" + #Plane msgid "GEOM_PLANE" msgstr "Plane" @@ -1348,6 +1364,9 @@ msgstr "Parametric point" msgid "GEOM_REF_POINT" msgstr "Point with reference" +msgid "GEOM_LINE_INTERSECTION" +msgstr "Point On Lines Intersection" + # #============================================================================== # diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 2571cae0b..6eefda984 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -692,6 +692,66 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec return aPrism; } +//============================================================================= +/*! + * MakePrismVecH2Ways + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theVec, + double theH) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || theVec.IsNull()) return NULL; + + //Add a new Prism object + Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM); + + //Add a new Prism function for creation a Prism relatively to vector + Handle(GEOM_Function) aFunction = + aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H_2WAYS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL; + + GEOMImpl_IPrism aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefVec = theVec->GetLastFunction(); + + if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetVector(aRefVec); + aCI.SetH(theH); + + //Compute the Prism value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + //SetErrorCode("Prism driver failed"); + SetErrorCode("Extrusion can not be created, check input data"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH2Ways(" + << theBase << ", " << theVec << ", " << theH << ")"; + + SetErrorCode(OK); + return aPrism; +} + //============================================================================= /*! * MakePrismTwoPnt @@ -753,6 +813,67 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt return aPrism; } +//============================================================================= +/*! + * MakePrismTwoPnt2Ways + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways + (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL; + + //Add a new Prism object + Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM); + + //Add a new Prism function for creation a Prism relatively to two points + Handle(GEOM_Function) aFunction = + aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT_2WAYS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL; + + GEOMImpl_IPrism aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction(); + + if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetFirstPoint(aRefPnt1); + aCI.SetLastPoint(aRefPnt2); + + //Compute the Prism value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + //SetErrorCode("Prism driver failed"); + SetErrorCode("Extrusion can not be created, check input data"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism2Ways(" + << theBase << ", " << thePoint1 << ", " << thePoint2 << ")"; + + SetErrorCode(OK); + return aPrism; +} + //============================================================================= /*! @@ -871,6 +992,63 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( return aRevolution; } +//============================================================================= +/*! + * MakeRevolutionAxisAngle2Ways + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways + (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theAxis, double theAngle) +{ + SetErrorCode(KO); + + if (theBase.IsNull() || theAxis.IsNull()) return NULL; + + //Add a new Revolution object + Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION); + + //Add a new Revolution function for creation a revolution relatively to axis + Handle(GEOM_Function) aFunction = + aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE_2WAYS); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL; + + GEOMImpl_IRevolution aCI (aFunction); + + Handle(GEOM_Function) aRefBase = theBase->GetLastFunction(); + Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction(); + + if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL; + + aCI.SetBase(aRefBase); + aCI.SetAxis(aRefAxis); + aCI.SetAngle(theAngle); + + //Compute the Revolution value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Revolution driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution2Ways(" + << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; + + SetErrorCode(OK); + return aRevolution; +} //============================================================================= /*! diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index d3d7ba49c..f87ddd5d5 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -59,10 +59,17 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theVec, double theH); + Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theVec, double theH); + Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt (Handle(GEOM_Object) theBase, Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2); + Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt2Ways (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) thePoint1, + Handle(GEOM_Object) thePoint2); + Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase, Handle(GEOM_Object) thePath); @@ -70,6 +77,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Handle(GEOM_Object) theAxis, double theAngle); + Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle2Ways (Handle(GEOM_Object) theBase, + Handle(GEOM_Object) theAxis, + double theAngle); + Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell); Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter); diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index 6ed1de04e..08d1fde18 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -231,6 +231,60 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve return aPoint; } +//============================================================================= +/*! + * MakePointOnLinesIntersection + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection + (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2) +{ + SetErrorCode(KO); + + if (theLine1.IsNull() || theLine2.IsNull()) return NULL; + + //Add a new Point object + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a new Point function for creation a point relativley another point + Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; + + GEOMImpl_IPoint aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetLine1(aRef1); + aPI.SetLine2(aRef2); + + //Compute the point value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Point driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection(" + << theLine1 << ", " << theLine2 << ")"; + + SetErrorCode(OK); + return aPoint; +} + //============================================================================= /*! * MakeTangentOnCurve @@ -501,6 +555,60 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt return aLine; } +//============================================================================= +/*! + * MakeLineTwoFaces + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces + (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2) +{ + SetErrorCode(KO); + + if (theFace1.IsNull() || theFace2.IsNull()) return NULL; + + //Add a new Line object + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + + //Add a new Line function + Handle(GEOM_Function) aFunction = + aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL; + + GEOMImpl_ILine aPI (aFunction); + + Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction(); + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aPI.SetFace1(aRef1); + aPI.SetFace2(aRef2); + + //Compute the Line value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Line driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces(" + << theFace1 << ", " << theFace2 << ")"; + + SetErrorCode(OK); + return aLine; +} //============================================================================= /*! diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx index 1b44aa4e8..e6155178b 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx @@ -41,6 +41,9 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve, double theParameter); + Standard_EXPORT Handle(GEOM_Object) MakePointOnLinesIntersection + (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2); + // Vector Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ); @@ -54,6 +57,9 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2); + Standard_EXPORT Handle(GEOM_Object) MakeLineTwoFaces (Handle(GEOM_Object) theFace1, + Handle(GEOM_Object) theFace2); + Standard_EXPORT Handle(GEOM_Object) MakeLine (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theDir); diff --git a/src/GEOMImpl/GEOMImpl_ILine.hxx b/src/GEOMImpl/GEOMImpl_ILine.hxx index 09d5fba74..99a60b778 100644 --- a/src/GEOMImpl/GEOMImpl_ILine.hxx +++ b/src/GEOMImpl/GEOMImpl_ILine.hxx @@ -22,8 +22,10 @@ #include "GEOM_Function.hxx" -#define LINE_ARG_PNT1 1 -#define LINE_ARG_PNT2 2 +#define LINE_ARG_PNT1 1 +#define LINE_ARG_PNT2 2 +#define LINE_ARG_FACE1 3 +#define LINE_ARG_FACE2 4 class GEOMImpl_ILine { @@ -33,9 +35,13 @@ class GEOMImpl_ILine void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT1, theRef); } void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT2, theRef); } + void SetFace1(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_FACE1, theRef); } + void SetFace2(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_FACE2, theRef); } Handle(GEOM_Function) GetPoint1() { return _func->GetReference(LINE_ARG_PNT1); } Handle(GEOM_Function) GetPoint2() { return _func->GetReference(LINE_ARG_PNT2); } + Handle(GEOM_Function) GetFace1() { return _func->GetReference(LINE_ARG_FACE1); } + Handle(GEOM_Function) GetFace2() { return _func->GetReference(LINE_ARG_FACE2); } private: diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx index 91dd98383..b796a51f5 100755 --- a/src/GEOMImpl/GEOMImpl_IPoint.hxx +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -30,6 +30,8 @@ #define ARG_PARAM 5 #define ARG_CURVE 6 +#define ARG_LINE1 7 +#define ARG_LINE2 8 class GEOMImpl_IPoint { @@ -50,8 +52,12 @@ class GEOMImpl_IPoint Handle(GEOM_Function) GetRef() { return _func->GetReference(ARG_REF); } void SetCurve(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_CURVE, theRef); } + void SetLine1(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE1, theRef); } + void SetLine2(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE2, theRef); } Handle(GEOM_Function) GetCurve() { return _func->GetReference(ARG_CURVE); } + Handle(GEOM_Function) GetLine1() { return _func->GetReference(ARG_LINE1); } + Handle(GEOM_Function) GetLine2() { return _func->GetReference(ARG_LINE2); } void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.cxx b/src/GEOMImpl/GEOMImpl_LineDriver.cxx index a7bf8d433..4f7b9263c 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.cxx @@ -27,13 +27,15 @@ #include #include - +#include #include #include #include #include #include #include +#include +#include #include #include @@ -92,6 +94,40 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const } aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape(); + } else if (aType == LINE_TWO_FACES) { + Handle(GEOM_Function) aRefFace1 = aPI.GetFace1(); + Handle(GEOM_Function) aRefFace2 = aPI.GetFace2(); + TopoDS_Shape aShape1 = aRefFace1->GetValue(); + TopoDS_Shape aShape2 = aRefFace2->GetValue(); + if (aShape1.ShapeType() != TopAbs_FACE || + aShape2.ShapeType() != TopAbs_FACE) { + Standard_ConstructionError::Raise("Wrong arguments: two faces must be given"); + } + if (aShape1.IsSame(aShape2)) { + Standard_ConstructionError::Raise("The end faces must be different"); + } + BRepAlgoAPI_Section E (aShape1, aShape2, Standard_False); + E.Approximation(Standard_True); + E.Build(); + if (!E.IsDone()) { + Standard_ConstructionError::Raise("Line can not be performed on the given faces"); + } + else + { + TopExp_Explorer Exp (E, TopAbs_EDGE); + if ( Exp.More() ){ + aShape = Exp.Current(); + Exp.Next(); + } + else + { + Standard_ConstructionError::Raise("Faces not have intersection line"); + aShape = E.Shape(); + } + if ( Exp.More() ) + aShape = E.Shape(); + } + } else if (aType == LINE_PNT_DIR) { Handle(GEOM_Function) aRefPnt = aPI.GetPoint1(); Handle(GEOM_Function) aRefDir = aPI.GetPoint2(); diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index 3b8f5270d..a511c53ea 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -27,7 +27,8 @@ #include #include - +#include +#include #include #include #include @@ -97,7 +98,34 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const aP = aFP + (aLP - aFP) * aPI.GetParameter(); aPnt = aCurve->Value(aP); - } else { + } else if (aType == POINT_LINES_INTERSECTION) { + Handle(GEOM_Function) aRef1 = aPI.GetLine1(); + Handle(GEOM_Function) aRef2 = aPI.GetLine2(); + + TopoDS_Shape aRefShape1 = aRef1->GetValue(); + TopoDS_Shape aRefShape2 = aRef2->GetValue(); + + if (aRefShape1.ShapeType() != TopAbs_EDGE || aRefShape2.ShapeType() != TopAbs_EDGE ) { + Standard_TypeMismatch::Raise + ("Creation Point On Lines Intersection Aborted : Line shape is not an edge"); + } + //Calculate Lines Intersection Point + BRepExtrema_DistShapeShape dst (aRefShape1, aRefShape2); + if (dst.IsDone()) + { + gp_Pnt P1, P2; + for (int i = 1; i <= dst.NbSolution(); i++) { + P1 = dst.PointOnShape1(i); + P2 = dst.PointOnShape2(i); + Standard_Real Dist = P1.Distance(P2); + if ( Dist <= Precision::Confusion() ) + aPnt = P1; + else + Standard_TypeMismatch::Raise ("Lines not have an Intersection Point"); + } + } + } + else { return 0; } diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 8d049aa56..1818018b0 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -38,6 +39,8 @@ #include #include +#include +#include #include //======================================================================= @@ -93,7 +96,35 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const } } } - } else if (aType == PRISM_BASE_TWO_PNT) { + } else if (aType == PRISM_BASE_VEC_H_2WAYS) { + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + Handle(GEOM_Function) aRefVector = aCI.GetVector(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + TopoDS_Shape aShapeVec = aRefVector->GetValue(); + if (aShapeVec.ShapeType() == TopAbs_EDGE) { + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + gp_Trsf aTrsf; + gp_Pnt aP1, aP2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (!V1.IsNull() && !V2.IsNull()) { + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (Abs(aCI.GetH()) < Precision::Confusion()) { + Standard_ConstructionError::Raise("Absolute value of prism height is too small"); + } + if (aV.Magnitude() > Precision::Confusion()) { + gp_Vec aVec; + aV.Normalize(); + aVec.Normalize(); + aVec = aV * (-aCI.GetH()); + aTrsf.SetTranslation(aVec); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + aShape = BRepPrimAPI_MakePrism(aShapeBase, (aV * aCI.GetH() * 2), Standard_False).Shape(); + } + } + } + } else if (aType == PRISM_BASE_TWO_PNT || aType == PRISM_BASE_TWO_PNT_2WAYS) { Handle(GEOM_Function) aRefBase = aCI.GetBase(); Handle(GEOM_Function) aRefPnt1 = aCI.GetFirstPoint(); Handle(GEOM_Function) aRefPnt2 = aCI.GetLastPoint(); @@ -107,6 +138,14 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const if (!V1.IsNull() && !V2.IsNull()) { gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); if (aV.Magnitude() > gp::Resolution()) { + if (aType == PRISM_BASE_TWO_PNT_2WAYS) + { + gp_Trsf aTrsf; + aTrsf.SetTranslation(-aV); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + aV = aV * 2; + } aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape(); } } diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx index 2f790ca3e..9d3d91ca3 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,7 @@ #include #include #include - +#include #include #include #include @@ -77,7 +78,7 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons TopoDS_Shape aShape; - if (aType == REVOLUTION_BASE_AXIS_ANGLE) { + if (aType == REVOLUTION_BASE_AXIS_ANGLE || aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS) { Handle(GEOM_Function) aRefBase = aCI.GetBase(); Handle(GEOM_Function) aRefAxis = aCI.GetAxis(); TopoDS_Shape aShapeBase = aRefBase->GetValue(); @@ -106,9 +107,17 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis"); } } - + double anAngle = aCI.GetAngle(); gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV); - BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, aCI.GetAngle(), Standard_False); + if (aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS) + { + gp_Trsf aTrsf; + aTrsf.SetRotation(anAxis, ( -anAngle )); + BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False); + aShapeBase = aTransformation.Shape(); + anAngle = anAngle * 2; + } + BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, anAngle, Standard_False); if (!MR.IsDone()) MR.Build(); if (!MR.IsDone()) StdFail_NotDone::Raise("Revolution algorithm has failed"); aShape = MR.Shape(); diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index c33d81b14..be924b3f7 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -89,10 +89,11 @@ #define EXPORT_SHAPE 1 #define IMPORT_SHAPE 1 -#define POINT_XYZ 1 -#define POINT_XYZ_REF 2 -#define POINT_CURVE_PAR 3 -//#define POINT_FACE_PAR 4 +#define POINT_XYZ 1 +#define POINT_XYZ_REF 2 +#define POINT_CURVE_PAR 3 +#define POINT_LINES_INTERSECTION 4 +//#define POINT_FACE_PAR 5 #define VECTOR_TWO_PNT 1 #define VECTOR_DX_DY_DZ 2 @@ -104,8 +105,9 @@ #define PLANE_THREE_PNT 3 #define PLANE_TANGENT_FACE 4 -#define LINE_TWO_PNT 1 -#define LINE_PNT_DIR 2 +#define LINE_TWO_PNT 1 +#define LINE_PNT_DIR 2 +#define LINE_TWO_FACES 3 #define TRANSLATE_TWO_POINTS 1 #define TRANSLATE_VECTOR 2 @@ -156,10 +158,13 @@ #define SPHERE_R 1 #define SPHERE_PNT_R 2 -#define PRISM_BASE_VEC_H 1 -#define PRISM_BASE_TWO_PNT 2 +#define PRISM_BASE_VEC_H 1 +#define PRISM_BASE_TWO_PNT 2 +#define PRISM_BASE_VEC_H_2WAYS 3 +#define PRISM_BASE_TWO_PNT_2WAYS 4 -#define REVOLUTION_BASE_AXIS_ANGLE 1 +#define REVOLUTION_BASE_AXIS_ANGLE 1 +#define REVOLUTION_BASE_AXIS_ANGLE_2WAYS 2 #define PIPE_BASE_PATH 1 #define PIPE_DIFFERENT_SECTIONS 2 diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index b5dbedc5e..75e6d670b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -31,6 +31,7 @@ #include "GeometryGUI.h" #include "GEOM_Actor.h" #include "GEOMBase.h" + #include "GEOM_Operation.h" #include "GEOM_Displayer.h" @@ -313,10 +314,18 @@ void GEOMToolsGUI::OnEditDelete() return; } // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish - + QString aNameList; + int nbSel = selected.Extent(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) + { + Handle(SALOME_InteractiveObject) io = It.Value(); + aNameList.append("\n - "); + aNameList.append(io->getName()); + } + if ( SUIT_MessageBox::warn2( app->desktop(), QObject::tr( "GEOM_WRN_WARNING" ), - QObject::tr( "GEOM_REALLY_DELETE" ), + QObject::tr( "GEOM_REALLY_DELETE" ).arg( nbSel ).arg( aNameList ), QObject::tr( "GEOM_BUT_YES" ), QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 ) return; diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index e730e0e03..276a9d556 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -349,6 +349,39 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH return GetObject(anObject); } +//============================================================================= +/*! + * MakePrismVecH2Ways + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakePrismTwoPnt @@ -387,6 +420,44 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt return GetObject(anObject); } +//============================================================================= +/*! + * MakePrismTwoPnt2Ways + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL) + return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject + (thePoint1->GetStudyID(), thePoint1->GetEntry()); + Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject + (thePoint2->GetStudyID(), thePoint2->GetEntry()); + + if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull()) + return aGEOMObject._retn(); + + //Create the Prism + Handle(GEOM_Object) anObject = + GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakePipe @@ -452,6 +523,39 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle return GetObject(anObject); } +//============================================================================= +/*! + * MakeRevolutionAxisAngle2Ways + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways + (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject + (theAxis->GetStudyID(), theAxis->GetEntry()); + + if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn(); + + //Create the Revolution + Handle(GEOM_Object) anObject = + GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeFilling diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index 936fc1330..564770946 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -81,10 +81,18 @@ class GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr theVec, CORBA::Double theH); + GEOM::GEOM_Object_ptr MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); + GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath); @@ -92,6 +100,10 @@ class GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr theAxis, CORBA::Double theAngle); + GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); + GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter); GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc index 4257ae0a2..fe525509c 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.cc +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -105,6 +105,39 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointWithReference return GetObject(anObject); } +//============================================================================= +/*! + * MakePointOnLinesIntersection + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection + (GEOM::GEOM_Object_ptr theLine1, GEOM::GEOM_Object_ptr theLine2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theLine1 == NULL || theLine2 == NULL) return aGEOMObject._retn(); + + //Get the reference Lines + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (theLine1->GetStudyID(), theLine1->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (theLine2->GetStudyID(), theLine2->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the point + + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnLinesIntersection(aRef1, aRef2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakePointOnCurve @@ -290,6 +323,38 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoPnt return GetObject(anObject); } +//============================================================================= +/*! + * MakeLineTwoFaces + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces + (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn(); + + //Get the reference points + + Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject + (theFace1->GetStudyID(), theFace1->GetEntry()); + Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject + (theFace2->GetStudyID(), theFace2->GetEntry()); + if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn(); + + //Create the Line + + Handle(GEOM_Object) anObject = + GetOperations()->MakeLineTwoFaces(aRef1, aRef2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh index 23ca696e7..2915b9534 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.hh +++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh @@ -52,6 +52,9 @@ class GEOM_IBasicOperations_i : GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1, + GEOM::GEOM_Object_ptr theLine2); + GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, CORBA::Double theParameter); @@ -68,6 +71,9 @@ class GEOM_IBasicOperations_i : GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2); + GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3, diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 5694df6da..666ec0861 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -545,6 +545,20 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the return anObj; } +//============================================================================= +// MakePointOnLinesIntersection: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1, + GEOM::GEOM_Object_ptr theRefLine2) +{ + beginService( " GEOM_Superv_i::MakePointOnLinesIntersection" ); + MESSAGE("GEOM_Superv_i::MakePointOnLinesIntersection"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnLinesIntersection(theRefLine1, theRefLine2); + endService( " GEOM_Superv_i::MakePointOnLinesIntersection" ); + return anObj; +} + //============================================================================= // MakeTangentOnCurve: //============================================================================= @@ -602,6 +616,20 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePn return anObj; } +//============================================================================= +// MakeLineTwoFaces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2) +{ + beginService( " GEOM_Superv_i::MakeLineTwoFaces"); + MESSAGE("GEOM_Superv_i::MakeLineTwoFaces"); + getBasicOp(); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakeLineTwoFaces(theFace1, theFace2); + endService( " GEOM_Superv_i::MakeLineTwoFaces"); + return anObj; +} + //============================================================================= // MakePlaneThreePnt: //============================================================================= @@ -880,6 +908,20 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH (GEOM::GEOM_Object_ptr theBas return anObj; } +//============================================================================= +// MakePrismVecH2Ways: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH) +{ + beginService( " GEOM_Superv_i::MakePrismVecH2Ways" ); + MESSAGE("GEOM_Superv_i::MakePrismVecH2Ways"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismVecH2Ways(theBase, theVec, theH); + endService( " GEOM_Superv_i::MakePrismVecH2Ways" ); + return anObj; +} //============================================================================= // MakePrismTwoPnt: @@ -896,6 +938,21 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt (GEOM::GEOM_Object_ptr theB return anObj; } +//============================================================================= +// MakePrismTwoPnt2Ways: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2) +{ + beginService( " GEOM_Superv_i::MakePrismTwoPnt2Ways" ); + MESSAGE("GEOM_Superv_i::MakePrismTwoPnt2Ways"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2); + endService( " GEOM_Superv_i::MakePrismTwoPnt2Ways" ); + return anObj; +} + //============================================================================= // MakePipe: //============================================================================= @@ -925,6 +982,21 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle (GEOM::GEOM_Object_ return anObj; } +//============================================================================= +// MakeRevolutionAxisAngle: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle) +{ + beginService( " GEOM_Superv_i::MakeRevolutionAxisAngle2Ways" ); + MESSAGE("GEOM_Superv_i::MakeRevolutionAxisAngle2Ways"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle); + endService( " GEOM_Superv_i::MakeRevolutionAxisAngle2Ways" ); + return anObj; +} + //============================================================================= // MakeFilling: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index da8451222..0d3039704 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -142,6 +142,8 @@ public: CORBA::Double theZ); GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1, + GEOM::GEOM_Object_ptr theRefLine2); GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, CORBA::Double theParameter); GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX, @@ -151,6 +153,8 @@ public: GEOM::GEOM_Object_ptr thePnt2); GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2); + GEOM::GEOM_Object_ptr MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1, + GEOM::GEOM_Object_ptr theFace2); GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3, @@ -213,14 +217,23 @@ public: GEOM::GEOM_Object_ptr MakePrismVecH (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec, CORBA::Double theH); + GEOM::GEOM_Object_ptr MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theVec, + CORBA::Double theH); GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint2); + GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePoint1, + GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath); GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis, CORBA::Double theAngle); + GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theAngle); GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 8ea2a03bc..6485368cf 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -394,12 +394,24 @@ def MakePrism(baseShape,point1,point2): print "MakePrismTwoPnt : ", PrimOp.GetErrorCode() return anObj +def MakePrism2Ways(baseShape,point1,point2): + anObj = PrimOp.MakePrismTwoPnt2Ways(baseShape,point1,point2) + if PrimOp.IsDone() == 0: + print "MakePrismTwoPnt2Ways : ", PrimOp.GetErrorCode() + return anObj + def MakePrismVecH(baseShape,vector,height): anObj = PrimOp.MakePrismVecH(baseShape,vector,height) if PrimOp.IsDone() == 0: print "MakePrismVecH : ", PrimOp.GetErrorCode() return anObj +def MakePrismVecH2Ways(baseShape,vector,height): + anObj = PrimOp.MakePrismVecH2Ways(baseShape,vector,height) + if PrimOp.IsDone() == 0: + print "MakePrismVecH2Ways : ", PrimOp.GetErrorCode() + return anObj + def MakePipe(baseShape,pathShape): anObj = PrimOp.MakePipe(baseShape,pathShape) if PrimOp.IsDone() == 0: @@ -412,6 +424,12 @@ def MakeRevolution(aShape,axis,angle): print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode() return anObj +def MakeRevolution2Ways(aShape,axis,angle): + anObj = PrimOp.MakeRevolutionAxisAngle2Ways(aShape,axis,angle) + if PrimOp.IsDone() == 0: + print "MakeRevolutionAxisAngle2Ways : ", PrimOp.GetErrorCode() + return anObj + # ----------------------------------------------------------------------------- # Create base shapes # ----------------------------------------------------------------------------- diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 7099489f1..aa985f00a 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -667,6 +667,11 @@ def MakePrism(theBase, thePoint1, thePoint2): anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2) RaiseIfFailed("MakePrismTwoPnt", PrimOp) return anObj +## The same prism but in two directions forward&backward. +def MakePrism2Ways(theBase, thePoint1, thePoint2): + anObj = PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2) + RaiseIfFailed("MakePrismTwoPnt2Ways", PrimOp) + return anObj ## Create a shape by extrusion of the base shape along the vector, # i.e. all the space, transfixed by the base shape during its translation @@ -682,6 +687,20 @@ def MakePrismVecH(theBase, theVec, theH): RaiseIfFailed("MakePrismVecH", PrimOp) return anObj +## Create a shape by extrusion of the base shape along the vector, +# i.e. all the space, transfixed by the base shape during its translation +# along the vector on the given distance in 2 Ways (forward/backward) . +# @param theBase Base shape to be extruded. +# @param theVec Direction of extrusion. +# @param theH Prism dimension along theVec in forward direction. +# @return New GEOM_Object, containing the created prism. +# +# Example: see GEOM_TestAll.py +def MakePrismVecH2Ways(theBase, theVec, theH): + anObj = PrimOp.MakePrismVecH2Ways(theBase, theVec, theH) + RaiseIfFailed("MakePrismVecH2Ways", PrimOp) + return anObj + ## Create a shape by extrusion of the base shape along # the path shape. The path shape can be a wire or an edge. # @param theBase Base shape to be extruded. @@ -707,6 +726,11 @@ def MakeRevolution(theBase, theAxis, theAngle): anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle) RaiseIfFailed("MakeRevolutionAxisAngle", PrimOp) return anObj +## The Same Revolution but in both ways forward&backward. +def MakeRevolution2Ways(theBase, theAxis, theAngle): + anObj = PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle) + RaiseIfFailed("MakeRevolutionAxisAngle2Ways", PrimOp) + return anObj ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. # @param theSeqSections - set of specified sections. diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index c1b1ffe5a..61072b77a 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -66,9 +66,9 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid RadioButton3->close(TRUE); RadioButton1->setChecked(true); + myBothway = myBothway2 = false; GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); - GroupPoints->CheckButton1->hide(); GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV")); GroupPoints->TextLabel1->setText(tr("GEOM_BASE")); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); @@ -77,9 +77,11 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid GroupPoints->PushButton2->setPixmap(image1); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY")); + GroupPoints->CheckButton1->setChecked(myBothway); GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); - GroupPoints2 = new DlgRef_3Sel_QTD(this, "GroupPoints2"); + GroupPoints2 = new DlgRef_3Sel1Check_QTD(this, "GroupPoints2"); GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P")); GroupPoints2->TextLabel1->setText(tr("GEOM_BASE")); GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg("1")); @@ -87,6 +89,8 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid GroupPoints2->PushButton1->setPixmap(image1); GroupPoints2->PushButton2->setPixmap(image1); GroupPoints2->PushButton3->setPixmap(image1); + GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY")); + GroupPoints2->CheckButton1->setChecked(myBothway2); Layout1->addWidget(GroupPoints, 2, 0); Layout1->addWidget(GroupPoints2, 2, 0); @@ -150,12 +154,13 @@ void GenerationGUI_PrismDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway2())); connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); @@ -432,7 +437,7 @@ void GenerationGUI_PrismDlg::ValueChangedInSpinBox() //================================================================================= double GenerationGUI_PrismDlg::getHeight() const { - return GroupPoints->SpinBox_DX->GetValue(); + return GroupPoints->SpinBox_DX->GetValue(); } //================================================================================= @@ -451,11 +456,9 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation() bool GenerationGUI_PrismDlg::isValid( QString& ) { if (getConstructorId() == 0) - // by vector and height - return (myOkBase && myOkVec); - - // by two points - return (myOkBase && myOkPnt1 && myOkPnt2); + return (myOkBase && myOkVec); // by vector and height + else + return (myOkBase && myOkPnt1 && myOkPnt2); // by two points } //================================================================================= @@ -470,14 +473,22 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects ) { case 0: { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakePrismVecH(myBase, myVec, getHeight()); + if (!myBothway) + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> + MakePrismVecH(myBase, myVec, getHeight()); + else + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> + MakePrismVecH2Ways(myBase, myVec, ( fabs(getHeight()) ) ); break; } case 1: { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> + if (!myBothway2) + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismTwoPnt(myBase, myPoint1, myPoint2); + else + anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> + MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2); break; } } @@ -497,3 +508,22 @@ void GenerationGUI_PrismDlg::onReverse() double anOldValue = GroupPoints->SpinBox_DX->GetValue(); GroupPoints->SpinBox_DX->SetValue( -anOldValue ); } + +//================================================================================= +// function : onBothway() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onBothway() +{ + bool anOldValue = myBothway; + myBothway = !anOldValue; + GroupPoints->CheckButton2->setEnabled(!myBothway); + displayPreview(); +} + +void GenerationGUI_PrismDlg::onBothway2() +{ + bool anOldValue = myBothway2; + myBothway2 = !anOldValue; + displayPreview(); +} diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index cf6efe6f4..a8b81837a 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -30,7 +30,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_2Sel1Spin2Check.h" -#include "DlgRef_3Sel_QTD.h" +#include "DlgRef_3Sel1Check_QTD.h" //================================================================================= // class : GenerationGUI_PrismDlg @@ -64,9 +64,11 @@ private: bool myOkVec; bool myOkPnt1; bool myOkPnt2; + bool myBothway; + bool myBothway2; DlgRef_2Sel1Spin2Check* GroupPoints; - DlgRef_3Sel_QTD* GroupPoints2; // for second layout for extrusion using 2 points + DlgRef_3Sel1Check_QTD* GroupPoints2; // for second layout for extrusion using 2 points private slots: void ClickOnOk(); @@ -79,6 +81,8 @@ private slots: void SetEditCurrentArgument(); void ValueChangedInSpinBox(); void onReverse(); + void onBothway(); + void onBothway2(); }; #endif // DIALOGBOX_PRISM_H diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 1956395ac..7d8a7dc08 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -66,9 +66,9 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWid RadioButton1->setPixmap(image0); RadioButton2->close(TRUE); RadioButton3->close(TRUE); + myBothway = false; GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints"); - GroupPoints->CheckButton1->hide(); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); @@ -77,6 +77,7 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWid GroupPoints->PushButton2->setPixmap(image1); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY")); GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE")); Layout1->addWidget(GroupPoints, 2, 0); @@ -128,6 +129,7 @@ void GenerationGUI_RevolDlg::Init() connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); @@ -345,8 +347,12 @@ bool GenerationGUI_RevolDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( - getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 ); + if (!myBothway) + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 ); + else + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + getOperation() )->MakeRevolutionAxisAngle2Ways( myBase, myAxis, getAngle() * PI180 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -364,3 +370,15 @@ void GenerationGUI_RevolDlg::onReverse() double anOldValue = GroupPoints->SpinBox_DX->GetValue(); GroupPoints->SpinBox_DX->SetValue( -anOldValue ); } + +//================================================================================= +// function : onBothway() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::onBothway() +{ + bool anOldValue = myBothway; + myBothway = !anOldValue; + GroupPoints->CheckButton2->setEnabled(!myBothway); + displayPreview(); +} diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index 6e99281f8..0c7d8e5bb 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -61,6 +61,7 @@ private : GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ bool myOkBase; bool myOkAxis; + bool myBothway; DlgRef_2Sel1Spin2Check* GroupPoints; @@ -73,6 +74,7 @@ private slots: void SetEditCurrentArgument(); void ValueChangedInSpinBox(); void onReverse(); + void onBothway(); }; #endif // DIALOGBOX_REVOLUTION_H diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index d2fa4198a..ef57e4f47 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -181,6 +181,12 @@ void GroupGUI_GroupDlg::Init() connect( myIdList, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); activateSelection(); + // activate subshapes selection if Main Shape is Selected + if ( !CORBA::is_nil( myMainObj ) ) { + myEditCurrentArgument = 0; + activateSelection(); + updateState(); + } } //================================================================================= @@ -296,7 +302,10 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myMainObj = anObj; myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); - updateState(); + // activate subshapes selection by default + myEditCurrentArgument = 0; + activateSelection(); + updateState(); return; } } @@ -654,7 +663,6 @@ void GroupGUI_GroupDlg::updateState() break; } } - if ( !isAdd ) { aMapIndex.Clear(); break; -- 2.39.2