From ef57a6ac8ac1eaebb8cc7f85f1f1a96df6dbabcb Mon Sep 17 00:00:00 2001 From: dmv Date: Thu, 18 Oct 2007 13:09:07 +0000 Subject: [PATCH] NPAL: 16557, 16558, 16578, 16549, 16561 --- idl/GEOM_Gen.idl | 55 ++- idl/GEOM_Superv.idl | 23 + resources/Makefile.am | 2 + resources/chamferall.png | Bin 288 -> 471 bytes resources/chamferedge.png | Bin 307 -> 480 bytes resources/chamferedgefromface.png | Bin 0 -> 492 bytes resources/chamferface.png | Bin 297 -> 495 bytes resources/circlecenter2pnts.png | Bin 0 -> 711 bytes src/BasicGUI/BasicGUI_CircleDlg.cxx | 71 ++- src/BasicGUI/BasicGUI_CircleDlg.h | 5 +- src/DlgRef/DlgRef_2Sel3Spin2Rb.cxx | 41 ++ src/DlgRef/DlgRef_2Sel3Spin2Rb.h | 34 ++ src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.cxx | 129 ++++++ src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.h | 60 +++ src/DlgRef/Makefile.am | 6 + src/DlgRef/UIFiles/DlgRef_2Sel3Spin2Rb_QTD.ui | 279 ++++++++++++ src/DlgRef/UIFiles/ui_to_cxx | 1 + src/GEOMContext/GEOM_icons.po | 5 + src/GEOMContext/GEOM_msg_en.po | 12 + src/GEOMGUI/GEOM_images.po | 9 + src/GEOMGUI/GEOM_msg_en.po | 39 +- src/GEOMImpl/GEOMImpl_ChamferDriver.cxx | 138 ++++-- src/GEOMImpl/GEOMImpl_CircleDriver.cxx | 46 +- src/GEOMImpl/GEOMImpl_FilletDriver.cxx | 17 +- src/GEOMImpl/GEOMImpl_IChamfer.hxx | 16 +- src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx | 61 +++ src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx | 3 + src/GEOMImpl/GEOMImpl_IFillet.hxx | 6 + src/GEOMImpl/GEOMImpl_ILocalOperations.cxx | 414 ++++++++++++++++++ src/GEOMImpl/GEOMImpl_ILocalOperations.hxx | 19 +- src/GEOMImpl/GEOMImpl_Types.hxx | 22 +- src/GEOM_I/GEOM_ICurvesOperations_i.cc | 34 ++ src/GEOM_I/GEOM_ICurvesOperations_i.hh | 4 + src/GEOM_I/GEOM_ILocalOperations_i.cc | 204 +++++++++ src/GEOM_I/GEOM_ILocalOperations_i.hh | 30 ++ src/GEOM_I_Superv/GEOM_Superv_i.cc | 135 +++++- src/GEOM_I_Superv/GEOM_Superv_i.hh | 21 +- src/GEOM_SWIG/GEOM_TestAll.py | 15 +- src/GEOM_SWIG/GEOM_example6.py | 60 +++ src/GEOM_SWIG/Makefile.am | 1 + src/GEOM_SWIG/batchmode_geompy.py | 40 ++ src/GEOM_SWIG/geompyDC.py | 58 +++ src/OperationGUI/OperationGUI_ChamferDlg.cxx | 336 ++++++++++---- src/OperationGUI/OperationGUI_ChamferDlg.h | 193 ++++---- src/OperationGUI/OperationGUI_FilletDlg.cxx | 93 +++- src/OperationGUI/OperationGUI_FilletDlg.h | 7 +- 46 files changed, 2477 insertions(+), 267 deletions(-) create mode 100755 resources/chamferedgefromface.png create mode 100755 resources/circlecenter2pnts.png create mode 100755 src/DlgRef/DlgRef_2Sel3Spin2Rb.cxx create mode 100755 src/DlgRef/DlgRef_2Sel3Spin2Rb.h create mode 100755 src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.cxx create mode 100755 src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.h create mode 100644 src/DlgRef/UIFiles/DlgRef_2Sel3Spin2Rb_QTD.ui create mode 100755 src/GEOM_SWIG/GEOM_example6.py diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 256df8ce5..9c161c2e3 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1792,7 +1792,15 @@ module GEOM GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2, in GEOM_Object thePnt3); - +/*! + * Create a circle with given center, with a radius equals the distance from center to Point1 + * and on a plane defined by all of three points. + * \param thePnt1,thePnt2,thePnt3 Points, defining the circle. + * \return New GEOM_Object, containing the created circle. + */ + GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3); /*! * Create an ellipse with given center, normal vector and radiuses. * \param thePnt Ellipse center. @@ -1926,7 +1934,10 @@ module GEOM GEOM_Object MakeFilletEdges (in GEOM_Object theShape, in double theR, in ListOfLong theEdges); - + GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape, + in double theR1, + in double theR2, + in ListOfLong theEdges); /*! * Perform a fillet on all edges of the specified faces of the given shape. * \param theShape Shape, to perform fillet on. @@ -1939,7 +1950,10 @@ module GEOM GEOM_Object MakeFilletFaces (in GEOM_Object theShape, in double theR, in ListOfLong theFaces); - + GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape, + in double theR1, + in double theR2, + in ListOfLong theFaces); /*! * Perform a symmetric chamfer on all edges of the given shape. * \param theShape Shape, to perform chamfer on. @@ -1963,7 +1977,13 @@ module GEOM GEOM_Object MakeChamferEdge (in GEOM_Object theShape, in double theD1, in double theD2, in long theFace1, in long theFace2); - + /*! + * The Same but with params theD = Chamfer Lenght + * and theAngle = Chamfer Angle (Angle in radians) + */ + GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in long theFace1, in long theFace2); /*! * Perform a chamfer on all edges of the specified faces. * with distance D1 on the first specified face (if several for one edge) @@ -1980,7 +2000,32 @@ module GEOM GEOM_Object MakeChamferFaces (in GEOM_Object theShape, in double theD1, in double theD2, in ListOfLong theFaces); - + /*! + * The Same but with params theD = Chamfer Lenght + * and theAngle = Chamfer Angle (Angle in radians) + */ + GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in ListOfLong theFaces); + + /*! + * Perform a chamfer on edges, + * with distance D1 on the first specified face (if several for one edge) + * \param theShape Shape, to perform chamfer on. + * \param theD1 theD2 Chamfer size + * \param theEdges Sequence of edges of \a theShape. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeChamferEdges (in GEOM_Object theShape, + in double theD1, in double theD2, + in ListOfLong theEdges); + /*! + * The Same but with params theD = Chamfer Lenght + * and theAngle = Chamfer Angle (Angle in radians) + */ + GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in ListOfLong theEdges); /*! * Perform an Archimde operation on the given shape with given parameters. * The object presenting the resulting face is returned diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 4ad14db98..7eaab4b6c 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -411,6 +411,9 @@ module GEOM GEOM_Object MakeCircleThreePnt (in GEOM_Object thePnt1, in GEOM_Object thePnt2, in GEOM_Object thePnt3) ; + GEOM_Object MakeCircleCenter2Pnt (in GEOM_Object thePnt1, + in GEOM_Object thePnt2, + in GEOM_Object thePnt3) ; GEOM_Object MakeEllipse (in GEOM_Object thePnt, in GEOM_Object theVec, in double theRMajor, @@ -436,17 +439,37 @@ module GEOM GEOM_Object MakeFilletEdges (in GEOM_Object theShape, in double theR, in GEOM_List theEdges) ; + GEOM_Object MakeFilletEdgesR1R2 (in GEOM_Object theShape, + in double theR1, + in double theR2, + in GEOM_List theEdges) ; GEOM_Object MakeFilletFaces (in GEOM_Object theShape, in double theR, in GEOM_List theFaces) ; + GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape, + in double theR1, + in double theR2, + in GEOM_List theFaces) ; GEOM_Object MakeChamferAll (in GEOM_Object theShape, in double theD) ; GEOM_Object MakeChamferEdge (in GEOM_Object theShape, in double theD1, in double theD2, in long theFace1, in long theFace2) ; + GEOM_Object MakeChamferEdgeAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in long theFace1, in long theFace2) ; GEOM_Object MakeChamferFaces (in GEOM_Object theShape, in double theD1, in double theD2, in GEOM_List theFaces) ; + GEOM_Object MakeChamferFacesAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in GEOM_List theFaces) ; + GEOM_Object MakeChamferEdges (in GEOM_Object theShape, + in double theD1, in double theD2, + in GEOM_List theEdges) ; + GEOM_Object MakeChamferEdgesAD (in GEOM_Object theShape, + in double theD, in double theAngle, + in GEOM_List theEdges) ; GEOM_Object MakeArchimede (in GEOM_Object theShape, in double theWeight, in double theWaterDensity, diff --git a/resources/Makefile.am b/resources/Makefile.am index 273ff9713..9db099085 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -55,11 +55,13 @@ chamfer.png \ chamferall.png \ chamferedge.png \ chamferface.png \ +chamferedgefromface.png \ change_orientation.png \ check.png \ circle.png \ circlepointvector.png \ circle3points.png \ +circlecenter2pnts.png \ common.png \ cone.png \ conedxyz.png \ diff --git a/resources/chamferall.png b/resources/chamferall.png index c90b6740ee7c5d52d46bb167e5cf423353a41e44..7fdbd13256086392e51f32832f660bf448ea2eb1 100644 GIT binary patch delta 445 zcmZ3$be(yEN@Ch>&U>cv9IQL;A9|QA=x9ymw};5 zm4Tt5nStTwe<1ymfuYoZf#FpG1B2BJ1_tr`N%2SB7#J9RJzX3_DsCnH`TyUZ*_6?N z!O$>3l7U6wDlZF%f>;WlvcRDO!E9!W4m)){R9CL|(FdwfYFG3TNV&0Bnu*73*7^@p zU*6bD&#>EAXUWXY&Cblu&d%(>kXRv^GDGCCe$zT8Nw(nc|ISvo@yFX4{Q2>*nNgu3 z;sS58W?0e>hH}QRe5J@=kIr(laVoIv6aY#UXxbFT@+_bJF_J~VA*4UGfnm|EMg~Tg zQf5Y``i@s@OfbjQOjf1E2zsB!A~gL_t(|+U1l%3WG2ZMJL6@1Y9V%@IKN56c1Dj(%VR{004R=004l4008;_004mL004C`008P>0026e000+nl3&F}00042NklgX00a=#4Fm`v29TFwm;vN_7)Isc#83aT{eMT+3lKnz$YIC`giyx+ zhK2?PX0af=j!DWiVUTA0#jtkWS_Tdl4h9Ym4hDb#!t^rGu;yu(2>J|U*u3dy!0h*L z-ZOmo@`2&Uj~@&G0mOo==qUr+e~5QYpdxKJ4TKp60x#aYV2}VpkP86<2*p5<^I@+0 z`)VCdFN0i%3x5Cv5Y=NDAb_ZDAV2_7-9Uf=BGXew<3u?K*$Um@^Wh(LiaA5H=(6Hudmk7EHWLOJS-TOE189sdZ!0_Y8 z4^$Wahj|mI7y=q_8rXtl>5Dfn7$krY004R=004l4008;_004mL004C`008P>0026e000+nl3&F}0004HNklgX00a=#4Fm`v7Gw@15F&Ai4hvwgF~al$1b+}Cau~u51RB=R(7?bf z7KGQJ+AKXVy>{JN1`ZYu1`ZAm27my<^fJ(}=4qD*x(Z|%Ox^o8?-@RP`M~hw#}5X8 z07CKdQwFyG5RaNbMcVKfiLms=n->fcKnQXnKmcL5P>S&v7|(93g0s;vJ^&CvRF7qV z0HV5q00BgG1AhSmi0TFc1Q68?1PCA&e3Fg8#ElK40+Z9e;}#2$Z;6+FDTL00Ial>pf#&{|`!k_zVN9`_IN84NQ+P!$1jIQbdwLKtO;2Ab>Co zBsQ$(x7Wc96W|eG5EKyv(*Oa)h+e?1Tfgo00M{wtF1r?q6xYXT4W&ufB*vkdkA54pj zt%X5CM1nz3L=e-<&C@P{>A$bmF))h-VKuBaOAn_-gFo4fKz{>S@JWJV8W(7UC3>{P z&w|S!TuBCM3OEG U@8G0800000Ne4wvM6N<$g51+%`~Uy| diff --git a/resources/circlecenter2pnts.png b/resources/circlecenter2pnts.png new file mode 100755 index 0000000000000000000000000000000000000000..7b3daa2d530c4e2f4285f3359e01c82583489d99 GIT binary patch literal 711 zcmV;&0yzDNP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;JxN4CRCwBA{Qv(y12q9a05LI882|(j3oZ%YhyysC zzIlZMBQ80B0D>EMUqRu&;)4f_FoU+NbmRe2;y}!eVHv~z|F{eW2p~pK7+(3w`JY=| zoZ;)umkhcbKR|}S41=-J!51KY=@Y*H7|3Fv8DC)%00G2!PhK9wYf29v211!Hp_w@G!K0wFNU{C^LOCWXy8u}lm79fB? zvCLf=za4Bg(7QWfHiKLTvlSF1$j$?a1Mxi|^AZrhfO(9Ok&zo9fEb{ry8`i4AYKE+ zbx@nZHo{yE4H|A7uC;`kqXZB@EJ%TT4~mb0YzDak?6R9c9nc87%)s#l=n9nZ0F3{{3D2cXN2 zAr%~;$T #include "GEOMImpl_Types.hxx" - #include "utilities.h" //================================================================================= @@ -53,6 +52,7 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* par { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PV"))); QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PNTS"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_C2P"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CIRCLE_TITLE")); @@ -61,7 +61,7 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* par GroupConstructors->setTitle(tr("GEOM_CIRCLE")); RadioButton1->setPixmap(image0); RadioButton2->setPixmap(image2); - RadioButton3->close(TRUE); + RadioButton3->setPixmap(image3); GroupPntVecR = new DlgRef_2Sel1Spin(this, "GroupPntVecR"); GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); @@ -88,8 +88,22 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* par Group3Pnts->LineEdit2->setReadOnly( true ); Group3Pnts->LineEdit3->setReadOnly( true ); + GroupCenter2Pnts = new DlgRef_3Sel_QTD(this, "GroupCenter2Pnts"); + GroupCenter2Pnts->GroupBox1->setTitle(tr("GEOM_CENTER_2POINTS")); + GroupCenter2Pnts->TextLabel1->setText(tr("GEOM_CENTER_POINT")); + GroupCenter2Pnts->TextLabel2->setText(tr("GEOM_POINT1")); + GroupCenter2Pnts->TextLabel3->setText(tr("GEOM_POINT2")); + GroupCenter2Pnts->PushButton1->setPixmap(image1); + GroupCenter2Pnts->PushButton2->setPixmap(image1); + GroupCenter2Pnts->PushButton3->setPixmap(image1); + + GroupCenter2Pnts->LineEdit1->setReadOnly( true ); + GroupCenter2Pnts->LineEdit2->setReadOnly( true ); + GroupCenter2Pnts->LineEdit3->setReadOnly( true ); + Layout1->addWidget( GroupPntVecR, 2, 0 ); Layout1->addWidget( Group3Pnts, 2, 0 ); + Layout1->addWidget( GroupCenter2Pnts, 2, 0 ); /***************************************************************/ setHelpFileName("circle.htm"); @@ -143,6 +157,10 @@ void BasicGUI_CircleDlg::Init() connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupCenter2Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupCenter2Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupCenter2Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); @@ -155,6 +173,7 @@ void BasicGUI_CircleDlg::Init() initName( tr( "GEOM_CIRCLE" ) ); Group3Pnts->hide(); + GroupCenter2Pnts->hide(); ConstructorsClicked( 0 ); } @@ -172,6 +191,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) case 0: { Group3Pnts->hide(); + GroupCenter2Pnts->hide(); resize(0, 0); GroupPntVecR->show(); @@ -183,6 +203,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) case 1: { GroupPntVecR->hide(); + GroupCenter2Pnts->hide(); resize( 0, 0 ); Group3Pnts->show(); @@ -192,6 +213,19 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) Group3Pnts->LineEdit3->setText(""); break; } + case 2: + { + GroupPntVecR->hide(); + Group3Pnts->hide(); + resize( 0, 0 ); + GroupCenter2Pnts->show(); + + myEditCurrentArgument = GroupCenter2Pnts->LineEdit1; + GroupCenter2Pnts->LineEdit1->setText(""); + GroupCenter2Pnts->LineEdit2->setText(""); + GroupCenter2Pnts->LineEdit3->setText(""); + break; + } } myEditCurrentArgument->setFocus(); @@ -248,6 +282,9 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = GEOM::GEOM_Object::_nil(); return; } @@ -255,15 +292,18 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) - { + { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = aSelectedObject; + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = aSelectedObject; + else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = aSelectedObject; } - displayPreview(); } @@ -281,6 +321,9 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1; else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2; else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3; + else if ( send == GroupCenter2Pnts->PushButton1 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit1; + else if ( send == GroupCenter2Pnts->PushButton2 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit2; + else if ( send == GroupCenter2Pnts->PushButton3 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit3; myEditCurrentArgument->setFocus(); @@ -302,7 +345,10 @@ void BasicGUI_CircleDlg::LineEditReturnPressed() send == GroupPntVecR->LineEdit2 || send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || - send == Group3Pnts->LineEdit3 ) + send == Group3Pnts->LineEdit3 || + send == GroupCenter2Pnts->LineEdit1 || + send == GroupCenter2Pnts->LineEdit2 || + send == GroupCenter2Pnts->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -362,7 +408,11 @@ void BasicGUI_CircleDlg::ValueChangedInSpinBox() //================================================================================= double BasicGUI_CircleDlg::getRadius() const { - return GroupPntVecR->SpinBox_DX->GetValue(); + switch ( getConstructorId() ) + { + case 0 : + return GroupPntVecR->SpinBox_DX->GetValue(); + } } //================================================================================= @@ -395,6 +445,9 @@ bool BasicGUI_CircleDlg::isValid( QString& msg ) else if ( id == 1 ) return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + else if ( id == 2 ) + return !myPoint4->_is_nil() && !myPoint5->_is_nil() && !myPoint6->_is_nil() && + !isEqual( myPoint4, myPoint5 ) && !isEqual( myPoint5, myPoint6 ) && !isEqual( myPoint4, myPoint6 ); return false; } @@ -410,6 +463,7 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) switch ( getConstructorId() ) { + cout << "constructior ID = " << getConstructorId() << endl; case 0 : anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); res = true; @@ -418,10 +472,15 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 ); res = true; break; + case 2 : + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleCenter2Pnt( myPoint4, myPoint5, myPoint6 ); + res = true; + break; } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); + else cout << "Execute Object is NULL!" << endl; return res; } diff --git a/src/BasicGUI/BasicGUI_CircleDlg.h b/src/BasicGUI/BasicGUI_CircleDlg.h index fb0f51315..3bf6e2015 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.h +++ b/src/BasicGUI/BasicGUI_CircleDlg.h @@ -62,11 +62,12 @@ private: void enterEvent(QEvent* e); double getRadius() const; - GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6; + CORBA::Double myRadius; DlgRef_2Sel1Spin* GroupPntVecR; DlgRef_3Sel_QTD* Group3Pnts; - + DlgRef_3Sel_QTD* GroupCenter2Pnts; private slots: void ClickOnOk(); void ClickOnCancel(); diff --git a/src/DlgRef/DlgRef_2Sel3Spin2Rb.cxx b/src/DlgRef/DlgRef_2Sel3Spin2Rb.cxx new file mode 100755 index 000000000..a17d55e41 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin2Rb.cxx @@ -0,0 +1,41 @@ +// File : DlgRef_2Sel2Spin.cxx +// Author : Dmitry MATVEITCHEV +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel3Spin2Rb.h" +#include + +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel3Spin2Rb which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_2Sel3Spin2Rb::DlgRef_2Sel3Spin2Rb(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel3Spin2Rb_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + RadioButton1->setChecked(true); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addMultiCellWidget(SpinBox_DX, 0, 0, 2, 4); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 2); + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout2->addWidget(SpinBox_DZ, 1, 4); + SpinBox_DY->setEnabled(false); + SpinBox_DZ->setEnabled(false); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel3Spin2Rb::~DlgRef_2Sel3Spin2Rb() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel3Spin2Rb.h b/src/DlgRef/DlgRef_2Sel3Spin2Rb.h new file mode 100755 index 000000000..e651662f7 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin2Rb.h @@ -0,0 +1,34 @@ +// File : DlgRef_2Sel3Spin2Rb.h +// Author : Dmitry MATVEITCHEV +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL3SPIN2RB_H +#define DLGREF_2SEL3SPIN2RB_H + +#include "DlgRef_2Sel3Spin2Rb_QTD.h" +#include "DlgRef_SpinBox.h" +//#if defined WNT +//#include +//#else +//#define SALOME_WNT_EXPORT +//#endif +#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS +#define DLGREF_WNT_EXPORT __declspec( dllexport ) +#else +#define DLGREF_WNT_EXPORT +#endif +class DLGREF_WNT_EXPORT DlgRef_2Sel3Spin2Rb : public DlgRef_2Sel3Spin2Rb_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel3Spin2Rb(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel3Spin2Rb(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; +}; + +#endif // DLGREF_2SEL3SPIN2RB_H diff --git a/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.cxx b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.cxx new file mode 100755 index 000000000..bcbd3d658 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.cxx @@ -0,0 +1,129 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel3Spin2Rb_QTD.ui' +** +** Created: Tue Oct 9 15:16:54 2007 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#include "DlgRef_2Sel3Spin2Rb_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel3Spin2Rb_QTD as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel3Spin2Rb_QTD::DlgRef_2Sel3Spin2Rb_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel3Spin2Rb_QTD" ); + DlgRef_2Sel3Spin2Rb_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel3Spin2Rb_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( TextLabel5, 1, 3 ); + + RadioButton2 = new QRadioButton( GroupBox1, "RadioButton2" ); + + Layout2->addWidget( RadioButton2, 1, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( TextLabel3, 0, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addMultiCellWidget( SpinBox1, 0, 0, 2, 4 ); + + RadioButton1 = new QRadioButton( GroupBox1, "RadioButton1" ); + + Layout2->addWidget( RadioButton1, 0, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 1, 4 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( TextLabel4, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + Spacer5 = new QSpacerItem( 0, 207, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( Spacer5, 3, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel3Spin2Rb_QTDLayout->addWidget( GroupBox1, 0, 0 ); + resize( QSize(439, 340).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel3Spin2Rb_QTD::~DlgRef_2Sel3Spin2Rb_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.h b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.h new file mode 100755 index 000000000..89f145aff --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel3Spin2Rb_QTD.ui' +** +** Created: Tue Oct 9 15:16:54 2007 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#ifndef DLGREF_2SEL3SPIN2RB_QTD_H +#define DLGREF_2SEL3SPIN2RB_QTD_H + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class QGroupBox; +class QPushButton; +class QLineEdit; +class QLabel; +class QRadioButton; +class QSpinBox; + +class DlgRef_2Sel3Spin2Rb_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel3Spin2Rb_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel3Spin2Rb_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QLabel* TextLabel5; + QRadioButton* RadioButton2; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QRadioButton* RadioButton1; + QSpinBox* SpinBox3; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QPushButton* PushButton2; + QLineEdit* LineEdit2; + QLabel* TextLabel1; + +protected: + QGridLayout* DlgRef_2Sel3Spin2Rb_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QSpacerItem* Spacer5; + QGridLayout* Layout2; + +}; + +#endif // DLGREF_2SEL3SPIN2RB_QTD_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index 27a7a9d8b..4db37c6eb 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -54,6 +54,8 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_2Sel2Spin1Check_QTD.cxx \ DlgRef_2Sel4Spin1Check_QTD.cxx \ DlgRef_3Sel4Spin2Check_QTD.cxx \ + DlgRef_2Sel3Spin2Rb_QTD.cxx \ + DlgRef_2Sel3Spin2Rb.cxx \ DlgRef_4Sel1List_QTD.cxx \ DlgRef_2Sel1List_QTD.cxx \ DlgRef_2Sel1List1Check_QTD.cxx \ @@ -106,6 +108,8 @@ MOC_FILES = \ DlgRef_2Sel1Spin_QTD_moc.cxx \ DlgRef_2Sel2Spin_QTD_moc.cxx \ DlgRef_2Sel3Spin_QTD_moc.cxx \ + DlgRef_2Sel3Spin2Rb_QTD_moc.cxx \ + DlgRef_2Sel3Spin2Rb_moc.cxx \ DlgRef_1Sel1Spin1Check_QTD_moc.cxx \ DlgRef_2Sel1Spin2Check_QTD_moc.cxx \ DlgRef_2Sel2Spin1Check_QTD_moc.cxx \ @@ -170,6 +174,8 @@ salomeinclude_HEADERS = \ DlgRef_2Sel2Spin1Check_QTD.h \ DlgRef_2Sel4Spin1Check_QTD.h \ DlgRef_3Sel4Spin2Check_QTD.h \ + DlgRef_2Sel3Spin2Rb_QTD.h \ + DlgRef_2Sel3Spin2Rb.h \ DlgRef_4Sel1List_QTD.h \ DlgRef_2Sel1List_QTD.h \ DlgRef_2Sel1List1Check_QTD.h \ diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel3Spin2Rb_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel3Spin2Rb_QTD.ui new file mode 100644 index 000000000..ca4821cc0 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel3Spin2Rb_QTD.ui @@ -0,0 +1,279 @@ + +DlgRef_2Sel3Spin2Rb_QTD + + + DlgRef_2Sel3Spin2Rb_QTD + + + + 0 + 0 + 439 + 340 + + + + DlgRef_2Sel3Spin2Rb_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + RadioButton2 + + + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + RadioButton1 + + + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 207 + + + + + + LineEdit2 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + RadioButton_Clicked() + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index bd1f907c1..54fd541d3 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -104,3 +104,4 @@ 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 + diff --git a/src/GEOMContext/GEOM_icons.po b/src/GEOMContext/GEOM_icons.po index 82eaeadd2..2af178b9c 100644 --- a/src/GEOMContext/GEOM_icons.po +++ b/src/GEOMContext/GEOM_icons.po @@ -129,6 +129,11 @@ msgstr "linepointvector.png" msgid "ICON_DLG_CIRCLE_PV" msgstr "circlepointvector.png" +#CircleDlg +msgid "ICON_DLG_CIRCLE_C2P" +msgstr "circlecenter2pnts.png" + + #VectorDlg msgid "ICON_DLG_VECTOR_2P" msgstr "vector2points.png" diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index 7dc8d22ea..9d956d722 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -322,6 +322,18 @@ msgstr "Center" msgid "GEOM_RADIUS" msgstr "Radius :" +#Radius +msgid "GEOM_CONSTANT_RADIUS" +msgstr "Radius :" + +#Radius +msgid "GEOM_R1" +msgstr "R1 :" + +#Radius +msgid "GEOM_R2" +msgstr "R2 :" + #Radius i msgid "GEOM_RADIUS_I" msgstr "Radius %1 :" diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po index e555f35ef..f968ecac8 100644 --- a/src/GEOMGUI/GEOM_images.po +++ b/src/GEOMGUI/GEOM_images.po @@ -133,6 +133,10 @@ msgstr "linepointvector.png" msgid "ICON_DLG_CIRCLE_PV" msgstr "circlepointvector.png" +#CircleDlg +msgid "ICON_DLG_CIRCLE_C2P" +msgstr "circlecenter2pnts.png" + #VectorDlg msgid "ICON_DLG_VECTOR_2P" msgstr "vector2points.png" @@ -370,6 +374,11 @@ msgstr "filletedge.png" msgid "ICON_DLG_CHAMFER_EDGE" msgstr "chamferedge.png" +#ChamferDlg +msgid "ICON_DLG_CHAMFER_EDGE_FROM_FACE" +msgstr "chamferedgefromface.png" + + #FilletDlg msgid "ICON_DLG_FILLET_FACE" msgstr "filletface.png" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 6489e4de0..958384b10 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -313,6 +313,18 @@ msgstr "Center" msgid "GEOM_RADIUS" msgstr "Radius :" +#Radius +msgid "GEOM_CONSTANT_RADIUS" +msgstr "Radius :" + +#Radius +msgid "GEOM_R1" +msgstr "R1 :" + +#Radius +msgid "GEOM_R2" +msgstr "R2 :" + #Radius i msgid "GEOM_RADIUS_I" msgstr "Radius %1 :" @@ -782,6 +794,10 @@ msgstr "D1 :" msgid "GEOM_D2" msgstr "D2 :" +#D +msgid "GEOM_D" +msgstr "D :" + # #============================================================================== # @@ -826,6 +842,14 @@ msgstr "Chamfer On Whole Shape" msgid "GEOM_CHAMFER_EDGES" msgstr "Chamfer On Edges From Shape" +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "GEOM_CHAMFER_EDGE" +msgstr "Chamfer On Selected Edges" + +#: GeometryGUI_ChamferDlg.cxx:58 +msgid "SELECTED_EDGE" +msgstr "Selected Edges" + #: GeometryGUI_ChamferDlg.cxx:58 msgid "GEOM_CHAMFER_FACES" msgstr "Chamfer On Faces From Shape" @@ -1485,6 +1509,9 @@ msgstr "Chamfer can't be computed with %1 and %2" msgid "GEOM_3_POINTS" msgstr "3 points" +msgid "GEOM_CENTER_2POINTS" +msgstr "Center and two points" + msgid "GEOM_POINT1" msgstr "Point 1" @@ -2857,13 +2884,13 @@ msgid "STB_ERASE_ALL" msgstr "Erase all" msgid "TOP_DISPLAY" -msgstr "Display" +msgstr "Show" msgid "MEN_DISPLAY" -msgstr "Display" +msgstr "Show" msgid "STB_DISPLAY" -msgstr "Display" +msgstr "Show object(s)" msgid "TOP_DISPLAY_ONLY" msgstr "Display only" @@ -2875,13 +2902,13 @@ msgid "STB_DISPLAY_ONLY" msgstr "Display only" msgid "TOP_ERASE" -msgstr "Erase" +msgstr "Hide" msgid "MEN_ERASE" -msgstr "Erase" +msgstr "Hide" msgid "STB_ERASE" -msgstr "Erase" +msgstr "Hide object(s)" msgid "TOP_POP_RENAME" msgstr "Rename" diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx index 57cc91748..61a812b55 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx @@ -132,37 +132,50 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const M.FindFromIndex(i).Extent() == 2) fill.Add(aD, E, F); } - } else if (aType == CHAMFER_SHAPE_EDGE) { + }else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) { // chamfer on edges, common to two faces, with D1 on the first face - double aD1 = aCI.GetD1(); - double aD2 = aCI.GetD2(); + TopoDS_Shape aFace1, aFace2; if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) && - GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2)) { - TopoDS_Face F = TopoDS::Face(aFace1); - - // fill map of edges of the second face - TopTools_MapOfShape aMap; - TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE); - for (; Exp2.More(); Exp2.Next()) { - aMap.Add(Exp2.Current()); + GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2)) + { + TopoDS_Face F = TopoDS::Face(aFace1); + + // fill map of edges of the second face + TopTools_MapOfShape aMap; + TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE); + for (; Exp2.More(); Exp2.Next()) { + aMap.Add(Exp2.Current()); + } + + // find edges of the first face, common with the second face + TopExp_Explorer Exp (aFace1, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (aMap.Contains(Exp.Current())) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) + { + if ( aType == CHAMFER_SHAPE_EDGE ) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + fill.AddDA(aD, anAngle, E, F); + } + } + } + } } - - // find edges of the first face, common with the second face - TopExp_Explorer Exp (aFace1, TopAbs_EDGE); - for (; Exp.More(); Exp.Next()) { - if (aMap.Contains(Exp.Current())) { - TopoDS_Edge E = TopoDS::Edge(Exp.Current()); - if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) - fill.Add(aD1, aD2, E, F); - } - } - } - } else if (aType == CHAMFER_SHAPE_FACES) { + } + else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) { // chamfer on all edges of the selected faces, with D1 on the selected face // (on first selected face, if the edge belongs to two selected faces) - double aD1 = aCI.GetD1(); - double aD2 = aCI.GetD2(); + int aLen = aCI.GetLength(); int ind = 1; TopTools_MapOfShape aMap; @@ -171,22 +184,67 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const for (; ind <= aLen; ind++) { TopoDS_Shape aShapeFace; - if (GEOMImpl_ILocalOperations::GetSubShape - (aShapeBase, aCI.GetFace(ind), aShapeFace)) { - TopoDS_Face F = TopoDS::Face(aShapeFace); - TopExp_Explorer Exp (F, TopAbs_EDGE); - for (; Exp.More(); Exp.Next()) { - if (!aMap.Contains(Exp.Current())) { - TopoDS_Edge E = TopoDS::Edge(Exp.Current()); - if (!BRepTools::IsReallyClosed(E, F) && - !BRep_Tool::Degenerated(E) && - M.FindFromKey(E).Extent() == 2) - fill.Add(aD1, aD2, E, F); - } - } - } + if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace)) + { + TopoDS_Face F = TopoDS::Face(aShapeFace); + TopExp_Explorer Exp (F, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + if (!aMap.Contains(Exp.Current())) + { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); + if (!BRepTools::IsReallyClosed(E, F) && + !BRep_Tool::Degenerated(E) && + M.FindFromKey(E).Extent() == 2) + if (aType == CHAMFER_SHAPE_FACES) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + fill.AddDA(aD, anAngle, E, F); + } + } + } + } } - } else { + } +else if (aType == CHAMFER_SHAPE_EDGES || aType == CHAMFER_SHAPE_EDGES_AD) + { + // chamfer on selected edges with lenght param D1 & D2. + + int aLen = aCI.GetLength(); + int ind = 1; + TopTools_MapOfShape aMap; + TopTools_IndexedDataMapOfShapeListOfShape M; + GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M); + for (; ind <= aLen; ind++) + { + TopoDS_Shape aShapeEdge; + if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetEdge(ind), aShapeEdge)) + { + TopoDS_Edge E = TopoDS::Edge(aShapeEdge); + const TopTools_ListOfShape& aFacesList = M.FindFromKey(E); + TopoDS_Face F = TopoDS::Face( aFacesList.First() ); + if (aType == CHAMFER_SHAPE_EDGES) + { + double aD1 = aCI.GetD1(); + double aD2 = aCI.GetD2(); + fill.Add(aD1, aD2, E, F); + } + else + { + double aD = aCI.GetD(); + double anAngle = aCI.GetAngle(); + fill.AddDA(aD, anAngle, E, F); + } + } + } + } + else { } fill.Build(); diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx index 7d3343366..79184422b 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -95,6 +95,48 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const } } } + else if (aType == CIRCLE_CENTER_TWO_PNT) { + Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); + Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); + Handle(GEOM_Function) aRefPoint3 = aCI.GetPoint3(); + TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue(); + TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue(); + TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue(); + if (aShapePnt1.ShapeType() == TopAbs_VERTEX && aShapePnt2.ShapeType() == TopAbs_VERTEX && + aShapePnt3.ShapeType() == TopAbs_VERTEX) + { + gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1)); + gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt2)); + gp_Pnt aP3 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt3)); + + if (aP1.Distance(aP2) < gp::Resolution() || + aP1.Distance(aP3) < gp::Resolution() || + aP2.Distance(aP3) < gp::Resolution()) + Standard_ConstructionError::Raise("Circle creation aborted: coincident points given"); + if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular())) + Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line"); + double x, y, z, x1, y1, z1, x2, y2, z2, dx, dy, dz, dx2, dy2, dz2, dx3, dy3, dz3, aRadius; + //Calculations for Radius + x = aP1.X(); y = aP1.Y(); z = aP1.Z(); + x1 = aP2.X(); y1 = aP2.Y(); z1 = aP2.Z(); + dx = x1 - x; + dy = y1 - y; + dz = z1 - z; + aRadius = sqrt(dx*dx + dy*dy + dz*dz); + //Calculations for Plane Vector + x2 = aP3.X(); y2 = aP3.Y(); z2 = aP3.Z(); + dx2 = x2 - x; dy2 = y2 - y; dz2 = z2 - z; + dx3 = ((dy*dz2) - (dy2*dz))/100; + dy3 = ((dx2*dz) - (dx*dz2))/100; + dz3 = ((dx*dy2) - (dx2*dy))/100; + //Make Plane Vector + gp_Dir aDir ( dx3, dy3, dz3 ); + //Make Circle + gp_Ax2 anAxes (aP1, aDir); + gp_Circ aCirc (anAxes, aRadius); + aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); + } + } else if (aType == CIRCLE_THREE_PNT) { Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1(); Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2(); @@ -116,9 +158,9 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line"); Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value(); aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge(); - } + } } - else { + else { } if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx index 3114733df..e662d4cac 100644 --- a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx @@ -83,17 +83,17 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const TopoDS_Edge E = TopoDS::Edge(Exp.Current()); fill.Add(E); } - } else if (aType == FILLET_SHAPE_EDGES) { + } else if (aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_EDGES_2R) { int aLen = aCI.GetLength(); int ind = 1; for (; ind <= aLen; ind++) { TopoDS_Shape aShapeEdge; if (GEOMImpl_ILocalOperations::GetSubShape (aShapeBase, aCI.GetEdge(ind), aShapeEdge)) { - fill.Add(TopoDS::Edge(aShapeEdge)); + fill.Add(TopoDS::Edge(aShapeEdge)); } } - } else if (aType == FILLET_SHAPE_FACES) { + } else if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_FACES_2R) { int aLen = aCI.GetLength(); int ind = 1; for (; ind <= aLen; ind++) { @@ -108,10 +108,15 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const } } else { } + if (aType == FILLET_SHAPE_FACES || aType == FILLET_SHAPE_EDGES || aType == FILLET_SHAPE_ALL) + for (int i = 1; i <= fill.NbContours(); i++) + fill.SetRadius(aCI.GetR(), i, 1); + else if (aType == FILLET_SHAPE_FACES_2R || aType == FILLET_SHAPE_EDGES_2R) + for (int i = 1; i <= fill.NbContours(); i++) + { + fill.SetRadius(aCI.GetR1(), aCI.GetR2(), i, 1); + } - for (int i = 1; i <= fill.NbContours(); i++) { - fill.SetRadius(aCI.GetR(), i, 1); - } fill.Build(); if (!fill.IsDone()) { StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius"); diff --git a/src/GEOMImpl/GEOMImpl_IChamfer.hxx b/src/GEOMImpl/GEOMImpl_IChamfer.hxx index 6c12fd184..17f7e5afc 100644 --- a/src/GEOMImpl/GEOMImpl_IChamfer.hxx +++ b/src/GEOMImpl/GEOMImpl_IChamfer.hxx @@ -22,11 +22,12 @@ #include "GEOM_Function.hxx" -#define CHAM_ARG_SH 1 -#define CHAM_ARG_D1 2 -#define CHAM_ARG_D2 3 -#define CHAM_ARG_LENG 4 -#define CHAM_ARG_LAST 4 +#define CHAM_ARG_SH 1 +#define CHAM_ARG_D1 2 +#define CHAM_ARG_D2 3 +#define CHAM_ARG_ANGLE 3 +#define CHAM_ARG_LENG 4 +#define CHAM_ARG_LAST 4 class GEOMImpl_IChamfer { @@ -41,10 +42,12 @@ class GEOMImpl_IChamfer void SetD (double theD) { _func->SetReal(CHAM_ARG_D1, theD); } void SetD1(double theD) { _func->SetReal(CHAM_ARG_D1, theD); } void SetD2(double theD) { _func->SetReal(CHAM_ARG_D2, theD); } + void SetAngle(double theAngle) { _func->SetReal(CHAM_ARG_ANGLE, theAngle); } double GetD () { return _func->GetReal(CHAM_ARG_D1); } double GetD1() { return _func->GetReal(CHAM_ARG_D1); } double GetD2() { return _func->GetReal(CHAM_ARG_D2); } + double GetAngle() { return _func->GetReal(CHAM_ARG_ANGLE); } void SetLength(int theLen) { _func->SetInteger(CHAM_ARG_LENG, theLen); } @@ -56,10 +59,13 @@ class GEOMImpl_IChamfer { _func->SetInteger(CHAM_ARG_LAST + 1, theFace); } void SetFace2(int theFace) { _func->SetInteger(CHAM_ARG_LAST + 2, theFace); } + void SetEdge(int theInd, int theEdge) + { _func->SetInteger(CHAM_ARG_LAST + theInd, theEdge); } int GetFace(int theInd) { return _func->GetInteger(CHAM_ARG_LAST + theInd); } int GetFace1() { return _func->GetInteger(CHAM_ARG_LAST + 1); } int GetFace2() { return _func->GetInteger(CHAM_ARG_LAST + 2); } + int GetEdge(int theInd) { return _func->GetInteger(CHAM_ARG_LAST + theInd); } private: diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 3643e6f39..1cf41ed4e 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -196,6 +196,67 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_ return aCircle; } +//============================================================================= +/*! + * MakeCircleCenter2Pnt + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) +{ + SetErrorCode(KO); + + if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; + + //Add a new Circle object + Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE); + + //Add a new Circle function for creation a circle relatively to center and 2 points + Handle(GEOM_Function) aFunction = + aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_CENTER_TWO_PNT); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL; + + GEOMImpl_ICircle aCI (aFunction); + + Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction(); + Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction(); + Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction(); + + if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL; + + aCI.SetPoint1(aRefPnt1); + aCI.SetPoint2(aRefPnt2); + aCI.SetPoint3(aRefPnt3); + + //Compute the Circle value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Circle 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) << aCircle << " = geompy.MakeCircleCenter2Pnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; + + SetErrorCode(OK); + return aCircle; +} + + //============================================================================= /*! * MakeCirclePntVecR diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index b0aa3cd39..34bb01148 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -41,6 +41,9 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeCircleThreePnt (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt3); + Standard_EXPORT Handle(GEOM_Object) MakeCircleCenter2Pnt (Handle(GEOM_Object) thePnt1, + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3); Standard_EXPORT Handle(GEOM_Object) MakeCirclePntVecR (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, double theR); diff --git a/src/GEOMImpl/GEOMImpl_IFillet.hxx b/src/GEOMImpl/GEOMImpl_IFillet.hxx index 703c0f74f..f9deb9b86 100644 --- a/src/GEOMImpl/GEOMImpl_IFillet.hxx +++ b/src/GEOMImpl/GEOMImpl_IFillet.hxx @@ -24,6 +24,8 @@ #define FILLET_ARG_SH 1 #define FILLET_ARG_R 2 +#define FILLET_ARG_R1 4 +#define FILLET_ARG_R2 5 #define FILLET_ARG_LENG 3 #define FILLET_ARG_LAST 3 @@ -38,8 +40,12 @@ class GEOMImpl_IFillet Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET_ARG_SH); } void SetR(double theR) { _func->SetReal(FILLET_ARG_R, theR); } + void SetR1(double theR1) { _func->SetReal(FILLET_ARG_R1, theR1); } + void SetR2(double theR2) { _func->SetReal(FILLET_ARG_R2, theR2); } double GetR() { return _func->GetReal(FILLET_ARG_R); } + double GetR1() { return _func->GetReal(FILLET_ARG_R1); } + double GetR2() { return _func->GetReal(FILLET_ARG_R2); } void SetLength(int theLen) { _func->SetInteger(FILLET_ARG_LENG, theLen); } diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 63e0126b0..3dcf6e9af 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -198,6 +198,77 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges return aFillet; } +//============================================================================= +/*! + * MakeFilletEdges R1 R2 + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdgesR1R2 + (Handle(GEOM_Object) theShape, double theR1, double theR2, list theEdges) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_EDGES_2R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL; + + GEOMImpl_IFillet aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR1(theR1); + aCI.SetR2(theR2); + int aLen = theEdges.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++, ind++) { + aCI.SetEdge(ind, (*it)); + } + + //Compute the Fillet value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Fillet 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 pd (aFunction); + pd << aFillet << " = geompy.MakeFilletR1R2(" << theShape + << ", " << theR1 << ", " < theFaces) +{ + SetErrorCode(KO); + + //Add a new Fillet object + Handle(GEOM_Object) aFillet = GetEngine()->AddObject(GetDocID(), GEOM_FILLET); + + //Add a new Fillet function + Handle(GEOM_Function) aFunction = + aFillet->AddFunction(GEOMImpl_FilletDriver::GetID(), FILLET_SHAPE_FACES_2R); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_FilletDriver::GetID()) return NULL; + + GEOMImpl_IFillet aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetR1(theR1); + aCI.SetR2(theR2); + int aLen = theFaces.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++, ind++) { + aCI.SetFace(ind, (*it)); + } + + //Compute the Fillet value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Fillet 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 pd (aFunction); + pd << aFillet << " = geompy.MakeFilletR1R2(" << theShape + << ", " << theR1 << ", " << theR2 << ", geompy.ShapeType[\"FACE\"], ["; + + it = theFaces.begin(); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aFillet; +} + //============================================================================= /*! * MakeChamferAll @@ -377,6 +518,64 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge return aChamfer; } +//============================================================================= +/*! + * MakeChamferEdgeAD + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgeAD + (Handle(GEOM_Object) theShape, double theD, double theAngle, + int theFace1, int theFace2) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGE_AD); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL; + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetD(theD); + aCI.SetAngle(theAngle); + aCI.SetFace1(theFace1); + aCI.SetFace2(theFace2); + + //Compute the Chamfer value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer 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) << aChamfer + << " = geompy.MakeChamferEdgeAD(" << theShape << ", " << theD + << ", " << theAngle << ", " << theFace1 << ", " << theFace2 << ")"; + cout << "ANGLE = " << theAngle << endl; + SetErrorCode(OK); + return aChamfer; +} + //============================================================================= /*! * MakeChamferFaces @@ -448,6 +647,221 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces return aChamfer; } +//============================================================================= +/*! + * MakeChamferFacesAD + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFacesAD + (Handle(GEOM_Object) theShape, double theD, double theAngle, + list theFaces) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_FACES_AD); + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) return NULL; + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return NULL; + + aCI.SetShape(aRefShape); + aCI.SetD(theD); + aCI.SetAngle(theAngle); + int aLen = theFaces.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++, ind++) { + aCI.SetFace(ind, (*it)); + } + + //Compute the Chamfer value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer 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 pd (aFunction); + pd << aChamfer << " = geompy.MakeChamferFacesAD(" << theShape + << ", " << theD << ", " << theAngle << ", ["; + + it = theFaces.begin(); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * MakeChamferEdges + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges + (Handle(GEOM_Object) theShape, double theD1, double theD2, + list theEdges) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGES); + if (aFunction.IsNull()) { return NULL; cout << "Edges Function is NULL!!!" << endl; } + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) + { return NULL; cout << "Chamfer Driver is NULL!!!" << endl; } + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) { return NULL; cout << "Shape is NULL!!!" << endl; } + + aCI.SetShape(aRefShape); + aCI.SetD1(theD1); + aCI.SetD2(theD2); + int aLen = theEdges.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++, ind++) { + aCI.SetEdge(ind, (*it)); + } + + //Compute the Chamfer value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer 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 pd (aFunction); + pd << aChamfer << " = geompy.MakeChamferEdges(" << theShape + << ", " << theD1 << ", " << theD2 << ", ["; + + it = theEdges.begin(); + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aChamfer; +} + +//============================================================================= +/*! + * MakeChamferEdgesAD + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdgesAD + (Handle(GEOM_Object) theShape, double theD, double theAngle, + list theEdges) +{ + SetErrorCode(KO); + + //Add a new Chamfer object + Handle(GEOM_Object) aChamfer = GetEngine()->AddObject(GetDocID(), GEOM_CHAMFER); + + //Add a new Chamfer function + Handle(GEOM_Function) aFunction = + aChamfer->AddFunction(GEOMImpl_ChamferDriver::GetID(), CHAMFER_SHAPE_EDGES_AD); + if (aFunction.IsNull()) { return NULL; cout << "Edges Function is NULL!!!" << endl; } + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ChamferDriver::GetID()) + { return NULL; cout << "Chamfer Driver is NULL!!!" << endl; } + + GEOMImpl_IChamfer aCI (aFunction); + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) { return NULL; cout << "Shape is NULL!!!" << endl; } + + aCI.SetShape(aRefShape); + aCI.SetD(theD); + aCI.SetAngle(theAngle); + int aLen = theEdges.size(); + aCI.SetLength(aLen); + + int ind = 1; + list::iterator it = theEdges.begin(); + for (; it != theEdges.end(); it++, ind++) { + aCI.SetEdge(ind, (*it)); + } + + //Compute the Chamfer value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Chamfer 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 pd (aFunction); + pd << aChamfer << " = geompy.MakeChamferEdgesAD(" << theShape + << ", " << theD << ", " << theAngle << ", ["; + + it = theEdges.begin(); + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); + } + pd << "])"; + + SetErrorCode(OK); + return aChamfer; +} + //============================================================================= /*! * Archimede diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx index a079bc569..479d1dc8b 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.hxx @@ -37,17 +37,34 @@ class GEOMImpl_ILocalOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeFilletAll (Handle(GEOM_Object) theShape, double theR); Standard_EXPORT Handle(GEOM_Object) MakeFilletEdges (Handle(GEOM_Object) theShape, double theR, list theEdges); + Standard_EXPORT Handle(GEOM_Object) MakeFilletEdgesR1R2 (Handle(GEOM_Object) theShape, + double theR1, double theR2, + list theEdges); Standard_EXPORT Handle(GEOM_Object) MakeFilletFaces (Handle(GEOM_Object) theShape, double theR, list theFaces); + Standard_EXPORT Handle(GEOM_Object) MakeFilletFacesR1R2 (Handle(GEOM_Object) theShape, + double theR1, double theR2, + list theFaces); Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD); Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape, double theD1, double theD2, int theFace1, int theFace2); + Standard_EXPORT Handle(GEOM_Object) MakeChamferEdgeAD (Handle(GEOM_Object) theShape, + double theD, double theAngle, + int theFace1, int theFace2); Standard_EXPORT Handle(GEOM_Object) MakeChamferFaces (Handle(GEOM_Object) theShape, double theD1, double theD2, list theFaces); - + Standard_EXPORT Handle(GEOM_Object) MakeChamferFacesAD (Handle(GEOM_Object) theShape, + double theD, double theAngle, + list theFaces); + Standard_EXPORT Handle(GEOM_Object) MakeChamferEdges (Handle(GEOM_Object) theShape, + double theD1, double theD2, + list theEdges); + Standard_EXPORT Handle(GEOM_Object) MakeChamferEdgesAD (Handle(GEOM_Object) theShape, + double theD, double theAngle, + list theEdges); Standard_EXPORT Handle(GEOM_Object) MakeArchimede (Handle(GEOM_Object) theShape, double theWeight, double theWaterDensity, double theMeshingDeflection); diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index adf629917..23b93efd5 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -163,6 +163,7 @@ #define PIPE_BASE_PATH 1 #define PIPE_DIFFERENT_SECTIONS 2 #define PIPE_SHELL_SECTIONS 3 +#define PIPE_SHELLS_WITHOUT_PATH 4 #define THRUSECTIONS_RULED 1 #define THRUSECTIONS_SMOOTHED 2 @@ -180,6 +181,7 @@ #define CIRCLE_THREE_PNT 1 #define CIRCLE_PNT_VEC_R 2 +#define CIRCLE_CENTER_TWO_PNT 3 #define SPLINE_BEZIER 1 #define SPLINE_INTERPOLATION 2 @@ -189,13 +191,19 @@ #define CIRC_ARC_THREE_PNT 1 #define CIRC_ARC_CENTER 2 -#define FILLET_SHAPE_ALL 1 -#define FILLET_SHAPE_EDGES 2 -#define FILLET_SHAPE_FACES 3 - -#define CHAMFER_SHAPE_ALL 1 -#define CHAMFER_SHAPE_EDGE 2 -#define CHAMFER_SHAPE_FACES 3 +#define FILLET_SHAPE_ALL 1 +#define FILLET_SHAPE_EDGES 2 +#define FILLET_SHAPE_FACES 3 +#define FILLET_SHAPE_EDGES_2R 4 +#define FILLET_SHAPE_FACES_2R 5 + +#define CHAMFER_SHAPE_ALL 1 +#define CHAMFER_SHAPE_EDGE 2 +#define CHAMFER_SHAPE_FACES 3 +#define CHAMFER_SHAPE_EDGES 4 +#define CHAMFER_SHAPE_EDGE_AD 5 +#define CHAMFER_SHAPE_FACES_AD 6 +#define CHAMFER_SHAPE_EDGES_AD 7 #define WIRE_EDGES 1 #define FACE_WIRE 2 diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index ea89b3709..3a15afb1b 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -119,6 +119,40 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt return GetObject(anObject); } +//============================================================================= +/*! + * MakeCircleCenter2Pnt + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleCenter2Pnt + (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn(); + + //Get the reference points + Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject + (thePnt1->GetStudyID(), thePnt1->GetEntry()); + Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject + (thePnt2->GetStudyID(), thePnt2->GetEntry()); + Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject + (thePnt3->GetStudyID(), thePnt3->GetEntry()); + + if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn(); + + // Make Circle + Handle(GEOM_Object) anObject = GetOperations()->MakeCircleCenter2Pnt(aPnt1, aPnt2, aPnt3); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeEllipse diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index f316dab52..d341c4575 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -48,6 +48,10 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theVector, double theRMajor, double theRMinor); diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.cc b/src/GEOM_I/GEOM_ILocalOperations_i.cc index 5b2430e9f..a9ec1fc6d 100644 --- a/src/GEOM_I/GEOM_ILocalOperations_i.cc +++ b/src/GEOM_I/GEOM_ILocalOperations_i.cc @@ -114,6 +114,41 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges return GetObject(anObject); } +//============================================================================= +/*! + * MakeFilletEdges R1 R2 + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2 + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, + CORBA::Double theR2, const GEOM::ListOfLong& theEdges) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference edges + int ind = 0; + int aLen = theEdges.length(); + list anEdges; + for (; ind < aLen; ind++) { + anEdges.push_back(theEdges[ind]); + } + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFilletEdgesR1R2(aShapeRef, theR1, theR2, anEdges); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeFilletFaces @@ -149,6 +184,41 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces return GetObject(anObject); } +//============================================================================= +/*! + * MakeFilletFaces R1 R2 + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2 + (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, + CORBA::Double theR2, const GEOM::ListOfLong& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference faces + int ind = 0; + int aLen = theFaces.length(); + list aFaces; + for (; ind < aLen; ind++) { + aFaces.push_back(theFaces[ind]); + } + + //Create the Fillet + Handle(GEOM_Object) anObject = + GetOperations()->MakeFilletFacesR1R2(aShapeRef, theR1, theR2, aFaces); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeChamferAll @@ -203,6 +273,33 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge return GetObject(anObject); } +//============================================================================= +/*! + * MakeChamferEdgeAD + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferEdgeAD(aShapeRef, theD, theAngle, theFace1, theFace2); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! @@ -239,6 +336,113 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces return GetObject(anObject); } +//============================================================================= +/*! + * MakeChamferFacesAD + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference faces + int ind = 0; + int aLen = theFaces.length(); + list aFaces; + for (; ind < aLen; ind++) { + aFaces.push_back(theFaces[ind]); + } + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferFacesAD(aShapeRef, theD, theAngle, aFaces); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeChamferEdges + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theEdges) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference edges + int ind = 0; + int aLen = theEdges.length(); + list aEdges; + for (; ind < aLen; ind++) { + aEdges.push_back(theEdges[ind]); + } + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferEdges(aShapeRef, theD1, theD2, aEdges); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeChamferEdgesAD + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD + (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theEdges) +{ + GEOM::GEOM_Object_var aGEOMObject; + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference shape + Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShapeRef.IsNull()) return aGEOMObject._retn(); + + //Get the reference edges + int ind = 0; + int aLen = theEdges.length(); + list aEdges; + for (; ind < aLen; ind++) { + aEdges.push_back(theEdges[ind]); + } + + //Create the Chamfer + Handle(GEOM_Object) anObject = + GetOperations()->MakeChamferEdgesAD(aShapeRef, theD, theAngle, aEdges); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} //============================================================================= /*! diff --git a/src/GEOM_I/GEOM_ILocalOperations_i.hh b/src/GEOM_I/GEOM_ILocalOperations_i.hh index c8f4a6565..79a80acfc 100644 --- a/src/GEOM_I/GEOM_ILocalOperations_i.hh +++ b/src/GEOM_I/GEOM_ILocalOperations_i.hh @@ -42,19 +42,49 @@ class GEOM_I_EXPORT GEOM_ILocalOperations_i : GEOM::GEOM_Object_ptr MakeFilletAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR); + GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, const GEOM::ListOfLong& theEdges); + + GEOM::GEOM_Object_ptr MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + const GEOM::ListOfLong& theEdges); + GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, const GEOM::ListOfLong& theFaces); + GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + const GEOM::ListOfLong& theFaces); + GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); + GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD1, CORBA::Double theD2, CORBA::Long theFace1, CORBA::Long theFace2); + + GEOM::GEOM_Object_ptr MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2); + GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD1, CORBA::Double theD2, const GEOM::ListOfLong& theFaces); + GEOM::GEOM_Object_ptr MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theFaces); + + GEOM::GEOM_Object_ptr MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + const GEOM::ListOfLong& theEdges); + + GEOM::GEOM_Object_ptr MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + const GEOM::ListOfLong& theEdges); + GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape, CORBA::Double theWeight, CORBA::Double theWaterDensity, diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index fa0a64a0e..31c215150 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -993,7 +993,6 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections return anObj; } - //============================================================================= // MakePipe: //============================================================================= @@ -1016,7 +1015,6 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections return anObj; } - //============================================================================= // MakeFuse: //============================================================================= @@ -2166,6 +2164,20 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleThreePnt (GEOM::GEOM_Object_ptr t endService( " GEOM_Superv_i::MakeCircleThreePnt" ); return anObj; } +//============================================================================= +// MakeCircleCenter2Pnt: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3) +{ + beginService( " GEOM_Superv_i::MakeCircleCenter2Pnt" ); + MESSAGE("GEOM_Superv_i::MakeCircleCenter2Pnt"); + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3); + endService( " GEOM_Superv_i::MakeCircleCenter2Pnt" ); + return anObj; +} //============================================================================= // MakeEllipse: @@ -2322,6 +2334,28 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdges (GEOM::GEOM_Object_ptr theS return NULL; } +//============================================================================= +// MakeFilletEdges R1 R2: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + GEOM::GEOM_List_ptr theEdges) +{ + beginService( " GEOM_Superv_i::MakeFilletEdgesR1R2" ); + MESSAGE("GEOM_Superv_i::MakeFilletEdgesR1R2"); + if (GEOM_List_i* aListImplE = + dynamic_cast*>(GetServant(theEdges, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletEdgesR1R2(theShape, theR1, + theR2, aListImplE->GetList()); + endService( " GEOM_Superv_i::MakeFilletEdgesR1R2" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeFilletEdgesR1R2" ); + return NULL; +} + //============================================================================= // MakeFilletFaces: //============================================================================= @@ -2342,6 +2376,28 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFaces (GEOM::GEOM_Object_ptr theS return NULL; } +//============================================================================= +// MakeFilletFaces R1 R2: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theR1, + CORBA::Double theR2, + GEOM::GEOM_List_ptr theFaces) +{ + beginService( " GEOM_Superv_i::MakeFilletFacesR1R2" ); + MESSAGE("GEOM_Superv_i::MakeFilletFacesR1R2"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theFaces, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFilletFacesR1R2(theShape, theR1, theR2, + aListImplF->GetList()); + endService( " GEOM_Superv_i::MakeFilletFacesR1R2" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeFilletFacesR1R2" ); + return NULL; +} + //============================================================================= // MakeChamferAll: //============================================================================= @@ -2370,6 +2426,21 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdge (GEOM::GEOM_Object_ptr theS return anObj; } +//============================================================================= +// MakeChamferEdgeAD: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2) +{ + beginService( " GEOM_Superv_i::MakeChamferEdgeAD" ); + MESSAGE("GEOM_Superv_i::MakeChamferEdgeAD"); + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2); + endService( " GEOM_Superv_i::MakeChamferEdgeAD" ); + return anObj; +} + //============================================================================= // MakeChamferFaces: //============================================================================= @@ -2390,6 +2461,66 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFaces (GEOM::GEOM_Object_ptr the return NULL; } +//============================================================================= +// MakeChamferFacesAD: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theFaces) +{ + beginService( " GEOM_Superv_i::MakeChamferFacesAD" ); + MESSAGE("GEOM_Superv_i::MakeChamferFacesAD"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theFaces, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferFacesAD(theShape, theD, theAngle, aListImplF->GetList()); + endService( " GEOM_Superv_i::MakeChamferFacesAD" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeChamferFacesAD" ); + return NULL; +} + +//============================================================================= +// MakeChamferEdges: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theEdges) +{ + beginService( " GEOM_Superv_i::MakeChamferEdges" ); + MESSAGE("GEOM_Superv_i::MakeChamferEdges"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theEdges, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdges(theShape, theD1, theD2, aListImplF->GetList()); + endService( " GEOM_Superv_i::MakeChamferEdges" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeChamferEdges" ); + return NULL; +} + +//============================================================================= +// MakeChamferEdgesAD: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theEdges) +{ + beginService( " GEOM_Superv_i::MakeChamferEdgesAD" ); + MESSAGE("GEOM_Superv_i::MakeChamferEdgesAD"); + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(theEdges, myPOA).in())) { + getLocalOp(); + GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeChamferEdgesAD(theShape, theD, theAngle, aListImplF->GetList()); + endService( " GEOM_Superv_i::MakeChamferEdgesAD" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeChamferEdgesAD" ); + return NULL; +} + //============================================================================= // MakeArchimede: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 84773c8c4..6075d2405 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -243,7 +243,7 @@ public: GEOM::GEOM_Object_ptr thePath, CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections); - + //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// @@ -477,6 +477,9 @@ public: GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); + GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1, + GEOM::GEOM_Object_ptr thePnt2, + GEOM::GEOM_Object_ptr thePnt3); GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theVector, CORBA::Double theRMajor, CORBA::Double theRMinor); @@ -500,15 +503,31 @@ public: CORBA::Double theR); GEOM::GEOM_Object_ptr MakeFilletEdges (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, GEOM::GEOM_List_ptr theEdges); + GEOM::GEOM_Object_ptr MakeFilletEdgesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, + CORBA::Double theR2, GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeFilletFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR, GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1, + CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces); GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD); GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD1, CORBA::Double theD2, CORBA::Long theFace1, CORBA::Long theFace2); + GEOM::GEOM_Object_ptr MakeChamferEdgeAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + CORBA::Long theFace1, CORBA::Long theFace2); GEOM::GEOM_Object_ptr MakeChamferFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD1, CORBA::Double theD2, GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_Object_ptr MakeChamferFacesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theFaces); + GEOM::GEOM_Object_ptr MakeChamferEdges (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD1, CORBA::Double theD2, + GEOM::GEOM_List_ptr theEdges); + GEOM::GEOM_Object_ptr MakeChamferEdgesAD (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theD, CORBA::Double theAngle, + GEOM::GEOM_List_ptr theEdges); GEOM::GEOM_Object_ptr MakeArchimede (GEOM::GEOM_Object_ptr theShape, CORBA::Double theWeight, CORBA::Double theWaterDensity, diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index a044befec..54b2762d6 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -1,6 +1,7 @@ # GEOM GEOM_SWIG : binding of C++ omplementaion with Python # # Copyright (C) 2003 CEA + # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,6 +25,7 @@ # Module : GEOM # $Header$ + def TestAll (geompy, math): #Create base Variables @@ -87,6 +89,7 @@ def TestAll (geompy, math): Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr + Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr @@ -191,14 +194,20 @@ def TestAll (geompy, math): f_ind_2 = geompy.GetSubShapeID(Prism, prism_faces[1]) IDlist_f = [f_ind_1, f_ind_2] - + #Local operations Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge, IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr + Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., ShapeTypeEdge, + IDlist_e) #(GEOM_Object_ptr, Double, Double, Short, ListOfLong)->GEOM_Object_ptr Chamfer = geompy.MakeChamferEdge(Prism, d1, d2, f_ind_1, f_ind_2) #(GEOM_Object_ptr, 2 Doubles, 2 Long)->GEOM_Object_ptr Chamfer2 = geompy.MakeChamferFaces(Prism, d1, d2, IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr + Chamfer3 = geompy.MakeChamferEdges(Prism, d1, d2, + IDlist_e) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr + Chamfer4 = geompy.MakeChamferFacesAD(Prism, d1, 0.2, + IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr #Create Patterns MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1) @@ -244,6 +253,7 @@ def TestAll (geompy, math): id_Arc = geompy.addToStudy(Arc, "Arc") id_Circle = geompy.addToStudy(Circle, "Circle") id_Circle1 = geompy.addToStudy(Circle1, "Circle by 3 points") + id_Circle2 = geompy.addToStudy(Circle2, "Circle by center and 2 points") id_Ellipse = geompy.addToStudy(Ellipse, "Ellipse") id_Polyline = geompy.addToStudy(Polyline, "Polyline") id_Bezier = geompy.addToStudy(Bezier, "Bezier") @@ -304,8 +314,11 @@ def TestAll (geompy, math): id_Orientation = geompy.addToStudy(Orientation, "Orientation") id_Fillet = geompy.addToStudy(Fillet, "Fillet") + id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2") id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge") id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces") + id_Chamfer3 = geompy.addToStudy(Chamfer3, "Chamfer on Edges") + id_Chamfer4 = geompy.addToStudy(Chamfer4, "Chamfer on Faces with params D Angle") id_MultiTrans1D = geompy.addToStudy(MultiTrans1D, "MultiTrans1D") id_MultiTrans2D = geompy.addToStudy(MultiTrans2D, "MultiTrans2D") diff --git a/src/GEOM_SWIG/GEOM_example6.py b/src/GEOM_SWIG/GEOM_example6.py new file mode 100755 index 000000000..91c373981 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_example6.py @@ -0,0 +1,60 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# Copyright (C) 2003 CEA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# File : GEOM_example6.py +# Author : Dmitry MATVEITCHEV +# Module : GEOM +# $Header$ + + +import salome +import geompy + +ind = 1 +circlelist = [] +while ind < 6: + x1 = 0. + (10. * ind) + y1 = 0. + z1 = 0. + x2 = 10. + (10. * ind) + y2 = 20. * (ind+1) + z2 = 30. * (ind+1) + x3 = 50. + (10. * ind) + y3 = 0. * (ind+1) + z3 = -10. * (ind+1) + + print x1, y1, z1, x2, y2, z2, x3, y3, z3 + + point1 = geompy.MakeVertex(x1, y1, z1) + name1 = "point1_%d"%(ind) + id_pt1 = geompy.addToStudy(point1, name1) + point2 = geompy.MakeVertex(x2, y2, z2) + name2 = "point2_%d"%(ind) + id_pt2 = geompy.addToStudy(point2, name2) + point3 = geompy.MakeVertex(x3, y3, z3) + name3 = "point3_%d"%(ind) + id_pt3 = geompy.addToStudy(point3, name3) + + name = "circle%d"%(ind) + circle = geompy.MakeCircleCenter2Pnt(point1, point2, point3) + id_circle = geompy.addToStudy(circle, name) + circlelist.append(circle) + ind = ind + 1 diff --git a/src/GEOM_SWIG/Makefile.am b/src/GEOM_SWIG/Makefile.am index ca9cc2ea7..040d500ce 100644 --- a/src/GEOM_SWIG/Makefile.am +++ b/src/GEOM_SWIG/Makefile.am @@ -54,6 +54,7 @@ dist_salomescript_DATA= \ GEOM_example3.py \ GEOM_example4.py \ GEOM_example5.py \ + GEOM_example6.py \ GEOM_moteur.py \ GEOM_TestAll.py \ GEOM_TestOthers.py \ diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 42e9ec5c2..145f962fb 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -249,6 +249,12 @@ def MakeCircleThreePnt(p1,p2,p3): print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode() return anObj +def MakeCircleCenter2Pnt(p1,p2,p3): + anObj = CurvesOp.MakeCircleCenter2Pnt(p1,p2,p3) + if CurvesOp.IsDone() == 0: + print "MakeCircleCenter2Pnt : ", CurvesOp.GetErrorCode() + return anObj + def MakeEllipse(p1,v1,radiusMaj,radiusMin): anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin) if CurvesOp.IsDone() == 0: @@ -852,6 +858,16 @@ def MakeFillet(aShape,radius,aShapeType,ListShape): print "MakeFillet : ", LocalOp.GetErrorCode() return anObj +def MakeFilletR1R2(aShape,radius1,radius2,aShapeType,ListShape): + anObj = None + if aShapeType == ShapeType["EDGE"]: + anObj = LocalOp.MakeFilletEdgesR1R2(aShape,radius1,radius2,ListShape) + else: + anObj = LocalOp.MakeFilletFacesR1R2(aShape,radius1,radius2,ListShape) + if LocalOp.IsDone() == 0: + print "MakeFilletR1R2 : ", LocalOp.GetErrorCode() + return anObj + def MakeChamferAll(aShape,d): anObj = LocalOp.MakeChamferAll(aShape,d) if LocalOp.IsDone() == 0: @@ -864,12 +880,36 @@ def MakeChamferEdge(aShape,d1,d2,face1,face2): print "MakeChamferEdge : ", LocalOp.GetErrorCode() return anObj +def MakeChamferEdgeAD(aShape,d,angle,face1,face2): + anObj = LocalOp.MakeChamferEdgeAD(aShape,d,angle,face1,face2) + if LocalOp.IsDone() == 0: + print "MakeChamferEdgeAD : ", LocalOp.GetErrorCode() + return anObj + def MakeChamferFaces(aShape,d1,d2,ListShape): anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape) if LocalOp.IsDone() == 0: print "MakeChamferFaces : ", LocalOp.GetErrorCode() return anObj +def MakeChamferFacesAD(aShape,d,angle,ListShape): + anObj = LocalOp.MakeChamferFacesAD(aShape,d,angle,ListShape) + if LocalOp.IsDone() == 0: + print "MakeChamferFacesAD : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferEdges(aShape,d1,d2,ListShape): + anObj = LocalOp.MakeChamferEdges(aShape,d1,d2,ListShape) + if LocalOp.IsDone() == 0: + print "MakeChamferEdges : ", LocalOp.GetErrorCode() + return anObj + +def MakeChamferEdgesAD(aShape,d,angle,ListShape): + anObj = LocalOp.MakeChamferEdgesAD(aShape,d,angle,ListShape) + if LocalOp.IsDone() == 0: + print "MakeChamferEdgesAD : ", LocalOp.GetErrorCode() + return anObj + def MakeChamfer(aShape,d1,d2,aShapeType,ListShape): anObj = None if aShapeType == ShapeType["EDGE"]: diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 0e1cb2aeb..011711d17 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -371,6 +371,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): if self.CurvesOp.IsDone() == 0: print "MakeCircleThreePnt : ", self.CurvesOp.GetErrorCode() return anObj + + ## Create a circle, with given point1 as center, + # passing through the point2 as radius and laying in the plane, + # defined by all three given points. + # @param thePnt1,thePnt2,thePnt3 Points, defining the circle. + # @return New GEOM_Object, containing the created circle. + # + # Example: see GEOM_example6.py + def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3): + anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3) + if self.CurvesOp.IsDone() == 0: + print "MakeCircleCenter2Pnt : ", self.CurvesOp.GetErrorCode() + return anObj ## Create an ellipse with given center, normal vector and radiuses. # @param thePnt Ellipse center. @@ -1841,6 +1854,16 @@ class geompyDC(GEOM._objref_GEOM_Gen): if self.LocalOp.IsDone() == 0: print "MakeFillet : ", self.LocalOp.GetErrorCode() return anObj + ## The same but with two Fillet Radius R1 and R2 + def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes): + anObj = None + if theShapeType == ShapeType["EDGE"]: + anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes) + else: + anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes) + if self.LocalOp.IsDone() == 0: + print "MakeFilletR1R2 : ", self.LocalOp.GetErrorCode() + return anObj ## Perform a symmetric chamfer on all edges of the given shape. # @param theShape Shape, to perform chamfer on. @@ -1869,6 +1892,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): if self.LocalOp.IsDone() == 0: print "MakeChamferEdge : ", self.LocalOp.GetErrorCode() return anObj + ## The Same chamfer but with params theD is chamfer lenght and + # theAngle is Angle of chamfer (angle in radians) + def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2): + anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2) + if self.LocalOp.IsDone() == 0: + print "MakeChamferEdgeAD : ", self.LocalOp.GetErrorCode() + return anObj ## Perform a chamfer on all edges of the specified faces, # with distance D1 on the first specified face (if several for one edge) @@ -1887,6 +1917,34 @@ class geompyDC(GEOM._objref_GEOM_Gen): if self.LocalOp.IsDone() == 0: print "MakeChamferFaces : ", self.LocalOp.GetErrorCode() return anObj + ## The Same chamfer but with params theD is chamfer lenght and + # theAngle is Angle of chamfer (angle in radians) + def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces): + anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces) + if self.LocalOp.IsDone() == 0: + print "MakeChamferFacesAD : ", self.LocalOp.GetErrorCode() + return anObj + + ## Perform a chamfer on edges, + # with distance D1 on the first specified face (if several for one edge) + # @param theShape Shape, to perform chamfer on. + # @param theD1 and theD2 Chamfer size + # @param theEdges Sequence of edges of \a theShape. + # @return New GEOM_Object, containing the result shape. + # + # Example: + def MakeChamferEdges(self, theShape, theD1, theD2, theEdges): + anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges) + if self.LocalOp.IsDone() == 0: + print "MakeChamferEdges : ", self.LocalOp.GetErrorCode() + return anObj + ## The Same chamfer but with params theD is chamfer lenght and + # theAngle is Angle of chamfer (angle in radians) + def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges): + anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges) + if self.LocalOp.IsDone() == 0: + print "MakeChamferEdgesAD : ", self.LocalOp.GetErrorCode() + return anObj ## Shortcut to MakeChamferEdge() and MakeChamferFaces() # diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 29ecc1795..b1d3aefff 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -1,22 +1,22 @@ // GEOM GEOMGUI : GUI for Geometry component // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // @@ -57,8 +57,9 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW myConstructorId = -1; QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); - QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE_FROM_FACE"))); QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); + QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); @@ -68,6 +69,8 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW RadioButton1->setPixmap( image1 ); RadioButton2->setPixmap( image2 ); RadioButton3->setPixmap( image3 ); + RadioButton4->show(); + RadioButton4->setPixmap( image4 ); // Create first group @@ -82,7 +85,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 ); aSpinGrp->setFrameStyle( QFrame::NoFrame ); aSpinGrp->setInsideMargin( 0 ); - + new QLabel( tr( "D" ), aSpinGrp ); mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp ); @@ -101,15 +104,32 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 ); createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 ); - aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp2 ); - aSpinGrp->setFrameStyle( QFrame::NoFrame ); - aSpinGrp->setInsideMargin( 0 ); + QGroupBox* aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp2 ); + aSpinGrp1->setFrameStyle( QFrame::NoFrame ); + aSpinGrp1->setInsideMargin( 0 ); + + myRadioButton[ RadioButton21] = new QRadioButton( aSpinGrp1 ); + + new QLabel( tr( "GEOM_D1" ), aSpinGrp1 ); + mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp1 ); + + new QLabel( tr( "GEOM_D2" ), aSpinGrp1 ); + mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp1 ); + + QGroupBox* aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp2 ); + aSpinGrp2->setFrameStyle( QFrame::NoFrame ); + aSpinGrp2->setInsideMargin( 0 ); + + myRadioButton[ RadioButton22] = new QRadioButton( aSpinGrp2 ); - new QLabel( tr( "GEOM_D1" ), aSpinGrp ); - mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp ); + new QLabel( tr( "GEOM_D" ), aSpinGrp2 ); + mySpinBox[ SpinBox23 ] = new DlgRef_SpinBox( aSpinGrp2 ); - new QLabel( tr( "GEOM_D2" ), aSpinGrp ); - mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp ); + new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 ); + mySpinBox[ SpinBox24 ] = new DlgRef_SpinBox( aSpinGrp2 ); + + ( new QLabel( myGrp2 ) )->setSizePolicy( + QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // Create third group @@ -122,17 +142,69 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 ); createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces ); - aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp3 ); - aSpinGrp->setFrameStyle( QFrame::NoFrame ); - aSpinGrp->setInsideMargin( 0 ); + aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp3 ); + aSpinGrp1->setFrameStyle( QFrame::NoFrame ); + aSpinGrp1->setInsideMargin( 0 ); + + myRadioButton[ RadioButton31] = new QRadioButton( aSpinGrp1 ); + + new QLabel( tr( "GEOM_D1" ), aSpinGrp1 ); + mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp1 ); - new QLabel( tr( "GEOM_D1" ), aSpinGrp ); - mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp ); + new QLabel( tr( "GEOM_D2" ), aSpinGrp1 ); + mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp1 ); - new QLabel( tr( "GEOM_D2" ), aSpinGrp ); - mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp ); + aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp3 ); + aSpinGrp2->setFrameStyle( QFrame::NoFrame ); + aSpinGrp2->setInsideMargin( 0 ); + + myRadioButton[ RadioButton32] = new QRadioButton( aSpinGrp2 ); + + new QLabel( tr( "GEOM_D" ), aSpinGrp2 ); + mySpinBox[ SpinBox33 ] = new DlgRef_SpinBox( aSpinGrp2 ); + + new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 ); + mySpinBox[ SpinBox34 ] = new DlgRef_SpinBox( aSpinGrp2 ); ( new QLabel( myGrp3 ) )->setSizePolicy( + QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + // Create fourth group + + myGrp4 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGE" ), this ); + + QGroupBox* aSelGrp4 = new QGroupBox( 3, Qt::Horizontal, myGrp4 ); + aSelGrp4->setFrameStyle( QFrame::NoFrame ); + aSelGrp4->setInsideMargin( 0 ); + + createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp4, MainObj4 ); + createSelWg( tr( "SELECTED_EDGE" ), iconSelect, aSelGrp4, Edges ); + + aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp4 ); + aSpinGrp1->setFrameStyle( QFrame::NoFrame ); + aSpinGrp1->setInsideMargin( 0 ); + + myRadioButton[ RadioButton41] = new QRadioButton( aSpinGrp1 ); + + new QLabel( tr( "GEOM_D1" ), aSpinGrp1 ); + mySpinBox[ SpinBox41 ] = new DlgRef_SpinBox( aSpinGrp1 ); + + new QLabel( tr( "GEOM_D2" ), aSpinGrp1 ); + mySpinBox[ SpinBox42 ] = new DlgRef_SpinBox( aSpinGrp1 ); + + aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp4 ); + aSpinGrp2->setFrameStyle( QFrame::NoFrame ); + aSpinGrp2->setInsideMargin( 0 ); + + myRadioButton[ RadioButton42] = new QRadioButton( aSpinGrp2 ); + + new QLabel( tr( "GEOM_D" ), aSpinGrp2 ); + mySpinBox[ SpinBox43 ] = new DlgRef_SpinBox( aSpinGrp2 ); + + new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 ); + mySpinBox[ SpinBox44 ] = new DlgRef_SpinBox( aSpinGrp2 ); + + ( new QLabel( myGrp4 ) )->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // Add groups to layout @@ -140,17 +212,23 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW Layout1->addWidget( myGrp1, 2, 0 ); Layout1->addWidget( myGrp2, 2, 0 ); Layout1->addWidget( myGrp3, 2, 0 ); + Layout1->addWidget( myGrp4, 2, 0 ); // Set range of spinboxes - + double SpecificStep = 10.0; QMap< int, DlgRef_SpinBox* >::iterator anIter; for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) - anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY ); + { + anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 ); + if ( anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24 ) + anIter.data()->RangeStepAndValidator( 0, 90, 5, 0 ); + } setHelpFileName("chamfer.htm"); /* Initialisations */ + RadioButtonPressed(); Init(); } @@ -203,14 +281,21 @@ void OperationGUI_ChamferDlg::Init() connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); + // radio buttons + QMap< int, QRadioButton* >::iterator anIterRadio; + for ( anIterRadio = myRadioButton.begin(); anIterRadio != myRadioButton.end(); ++anIterRadio ) + connect( anIterRadio.data(), SIGNAL( clicked() ), + this, SLOT( RadioButtonPressed() ) ); + // selection connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_CHAMFER" ) ); - myGrp2->hide(); + myGrp4->hide(); myGrp3->hide(); + myGrp2->hide(); myGrp1->show(); } @@ -233,18 +318,29 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId ) return; // Get values from previous widget - double D1 = 5, D2 = 5; + double D1 = 5, D2 = 5, D = 5, Angle = 5; if ( myConstructorId == 0 ) D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue(); else if ( myConstructorId == 1 ) { D1 = mySpinBox[ SpinBox21 ]->GetValue(); D2 = mySpinBox[ SpinBox22 ]->GetValue(); + D = mySpinBox[ SpinBox23 ]->GetValue(); + Angle = mySpinBox[ SpinBox24 ]->GetValue(); } else if ( myConstructorId == 2 ) { D1 = mySpinBox[ SpinBox31 ]->GetValue(); D2 = mySpinBox[ SpinBox32 ]->GetValue(); + D = mySpinBox[ SpinBox33 ]->GetValue(); + Angle = mySpinBox[ SpinBox34 ]->GetValue(); + } + else if ( myConstructorId == 3 ) + { + D1 = mySpinBox[ SpinBox41 ]->GetValue(); + D2 = mySpinBox[ SpinBox42 ]->GetValue(); + D = mySpinBox[ SpinBox43 ]->GetValue(); + Angle = mySpinBox[ SpinBox44 ]->GetValue(); } myConstructorId = constructorId; @@ -255,21 +351,38 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId ) myGrp1->show(); myGrp2->hide(); myGrp3->hide(); + myGrp4->hide(); mySpinBox[ SpinBox1 ]->SetValue( D1 ); break; case 1: myGrp1->hide(); myGrp2->show(); myGrp3->hide(); + myGrp4->hide(); mySpinBox[ SpinBox21 ]->SetValue( D1 ); mySpinBox[ SpinBox22 ]->SetValue( D2 ); + mySpinBox[ SpinBox23 ]->SetValue( D ); + mySpinBox[ SpinBox24 ]->SetValue( Angle ); break; case 2: myGrp1->hide(); myGrp2->hide(); myGrp3->show(); + myGrp4->hide(); mySpinBox[ SpinBox31 ]->SetValue( D1 ); - mySpinBox[ SpinBox32 ]->SetValue( D2 ); + mySpinBox[ SpinBox32 ]->SetValue( D2 ); + mySpinBox[ SpinBox33 ]->SetValue( D ); + mySpinBox[ SpinBox34 ]->SetValue( Angle ); + break; + case 3: + myGrp1->hide(); + myGrp2->hide(); + myGrp3->hide(); + myGrp4->show(); + mySpinBox[ SpinBox41 ]->SetValue( D1 ); + mySpinBox[ SpinBox42 ]->SetValue( D2 ); + mySpinBox[ SpinBox43 ]->SetValue( D ); + mySpinBox[ SpinBox44 ]->SetValue( Angle ); break; default: break; @@ -277,7 +390,8 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId ) if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ]; else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ]; - else myEditCurrentArgument = mySelName[ MainObj3 ]; + else if ( constructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ]; + else myEditCurrentArgument = mySelName[ MainObj4 ]; activateSelection(); enableWidgets(); @@ -317,7 +431,6 @@ bool OperationGUI_ChamferDlg::ClickOnApply() return true; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection has changed @@ -338,7 +451,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() } // If selection of main object is activated - if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) + if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4) { if ( IObjectCount() == 1 ) { @@ -379,7 +492,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1"; myEditCurrentArgument->setText( aFaceName.arg( anIndex ) ); myFace[ aCurrFocus ] = anIndex; - displayPreview(); + displayPreview(); return; } } @@ -387,8 +500,8 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() myFace[ aCurrFocus ] = -1; } - // If face selection of third tab is activated - else if ( aCurrFocus == Faces ) + // If face selection of third or fourth tab is activated + else if ( aCurrFocus == Faces || aCurrFocus == Edges ) { if ( IObjectCount() == 1 ) { @@ -403,24 +516,30 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() if ( anIndexes.Extent() > 0 ) { - QString aFaceName; + QString aName; if ( anIndexes.Extent() == 1 ) { int anIndex = anIndexes( 1 ); - aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); + aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); } else - aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() ); - - myEditCurrentArgument->setText( aFaceName ); - myFaces = anIndexes; + aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() ); + + myEditCurrentArgument->setText( aName ); + int aConstructorId = getConstructorId(); + if ( aConstructorId == 2) + myFaces = anIndexes; + else if (aConstructorId == 3) + myEdges = anIndexes; + displayPreview(); return; } } } myFaces.Clear(); + myEdges.Clear(); } } @@ -441,6 +560,38 @@ void OperationGUI_ChamferDlg::LineEditReturnPressed() GEOMBase_Skeleton::LineEditReturnPressed(); } +//================================================================================= +// function : RadioButtonPressed() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::RadioButtonPressed() +{ + bool flag; + flag = ( myRadioButton[ RadioButton21 ]->isChecked() && + myRadioButton[ RadioButton31 ]->isChecked() && + myRadioButton[ RadioButton41 ]->isChecked() ); + + myRadioButton[ RadioButton21 ]->setChecked(!flag); + myRadioButton[ RadioButton31 ]->setChecked(!flag); + myRadioButton[ RadioButton41 ]->setChecked(!flag); + myRadioButton[ RadioButton22 ]->setChecked(flag); + myRadioButton[ RadioButton32 ]->setChecked(flag); + myRadioButton[ RadioButton42 ]->setChecked(flag); + mySpinBox[ SpinBox21 ]->setDisabled(flag); + mySpinBox[ SpinBox22 ]->setDisabled(flag); + mySpinBox[ SpinBox31 ]->setDisabled(flag); + mySpinBox[ SpinBox32 ]->setDisabled(flag); + mySpinBox[ SpinBox41 ]->setDisabled(flag); + mySpinBox[ SpinBox42 ]->setDisabled(flag); + mySpinBox[ SpinBox23 ]->setDisabled(!flag); + mySpinBox[ SpinBox24 ]->setDisabled(!flag); + mySpinBox[ SpinBox33 ]->setDisabled(!flag); + mySpinBox[ SpinBox34 ]->setDisabled(!flag); + mySpinBox[ SpinBox43 ]->setDisabled(!flag); + mySpinBox[ SpinBox44 ]->setDisabled(!flag); + displayPreview(); +} + //================================================================================= // function : SetEditCurrentArgument() @@ -448,7 +599,7 @@ void OperationGUI_ChamferDlg::LineEditReturnPressed() //================================================================================= void OperationGUI_ChamferDlg::SetEditCurrentArgument() { - QPushButton* aSender = ( QPushButton* )sender(); + QPushButton* aSender = ( QPushButton* )sender(); QMap< int, QPushButton* >::iterator anIter; for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) @@ -521,7 +672,7 @@ void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl, //================================================================================= void OperationGUI_ChamferDlg::reset() { - // Set Initial values of spinboxes + // Set Initial values of spinboxes QMap< int, DlgRef_SpinBox* >::iterator anIter; for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) anIter.data()->SetValue( 5 ); @@ -536,11 +687,13 @@ void OperationGUI_ChamferDlg::reset() if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ]; else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ]; - else myEditCurrentArgument = mySelName[ MainObj3 ]; + else if ( aConstructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ]; + else myEditCurrentArgument = mySelName[ MainObj4 ]; myShape = GEOM::GEOM_Object::_nil(); myFaces.Clear(); + myEdges.Clear(); myFace[ Face1 ] = -1; myFace[ Face2 ] = -1; @@ -569,8 +722,10 @@ void OperationGUI_ChamferDlg::activateSelection() if ( !myShape->_is_nil() && ( myEditCurrentArgument == mySelName[ Face1 ] || myEditCurrentArgument == mySelName[ Face2 ] || - myEditCurrentArgument == mySelName[ Faces ] ) ) + myEditCurrentArgument == mySelName[ Faces ] ) ) localSelection( myShape, TopAbs_FACE ); + else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] ) + localSelection( myShape, TopAbs_EDGE ); else { TColStd_MapOfInteger aMap; @@ -611,9 +766,21 @@ void OperationGUI_ChamferDlg::enableWidgets() else if ( anId == 2 ) { mySelName[ Faces ]->setEnabled( toEnable ); + if ( !toEnable ) + { + mySelName[ Faces ]->setText( "" ); + myFaces = -1; + } + } + else if ( anId == 3 ) + { + mySelName[ Edges ]->setEnabled( toEnable ); if ( !toEnable ) - myFaces.Clear(); + { + mySelName[ Edges ]->setText( "" ); + myEdges = -1; + } } } @@ -625,7 +792,6 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation() { return getGeomEngine()->GetILocalOperations( getStudyId() ); } - //================================================================================= // function : ClickOnApply() // purpose : Verify validity of input data @@ -637,6 +803,7 @@ bool OperationGUI_ChamferDlg::isValid( QString& ) case 0: return !myShape->_is_nil(); case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0; case 2: return !myShape->_is_nil() && myFaces.Extent() > 0; + case 3: return !myShape->_is_nil() && myEdges.Extent() > 0; default: return false; } } @@ -648,6 +815,9 @@ bool OperationGUI_ChamferDlg::isValid( QString& ) bool OperationGUI_ChamferDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; + bool flag = ( myRadioButton[ RadioButton21 ]->isChecked() && + myRadioButton[ RadioButton31 ]->isChecked() && + myRadioButton[ RadioButton41 ]->isChecked() ); int anId = getConstructorId(); if ( anId == 0 ) @@ -655,30 +825,55 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects ) getOperation() )->MakeChamferAll( myShape, mySpinBox[ SpinBox1 ]->GetValue() ); else if ( anId == 1 ) - anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeChamferEdge( myShape, - mySpinBox[ SpinBox21 ]->GetValue(), - mySpinBox[ SpinBox22 ]->GetValue(), - myFace[ Face1 ], - myFace[ Face2 ] ); + { + if ( flag ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferEdge( myShape, + mySpinBox[ SpinBox21 ]->GetValue(), + mySpinBox[ SpinBox22 ]->GetValue(), + myFace[ Face1 ], + myFace[ Face2 ] ); + else + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferEdgeAD( myShape, + mySpinBox[ SpinBox23 ]->GetValue(), + mySpinBox[ SpinBox24 ]->GetValue() * PI180, + myFace[ Face1 ], + myFace[ Face2 ]); + } else if ( anId == 2 ) { - - int i = 0; GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; anArray->length( myFaces.Extent() ); - - for ( int i = 1, n = myFaces.Extent(); i <= n; i++ ) - anArray[ i - 1 ] = myFaces( i ); - + anArray[ i - 1 ] = myFaces( i ); + if ( flag ) anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->MakeChamferFaces( myShape, mySpinBox[ SpinBox31 ]->GetValue(), mySpinBox[ SpinBox32 ]->GetValue(), anArray ); + else + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferFacesAD( myShape, + mySpinBox[ SpinBox33 ]->GetValue(), + mySpinBox[ SpinBox34 ]->GetValue() * PI180, + anArray ); + } + else if ( anId == 3 ) + { GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; + anArray->length( myEdges.Extent() ); + for ( int i = 1, n = myEdges.Extent(); i <= n; i++ ) + anArray[ i - 1 ] = myEdges( i ); + if ( flag ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferEdges( myShape, mySpinBox[ SpinBox41 ]->GetValue(), + mySpinBox[ SpinBox42 ]->GetValue(), anArray ); + else + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeChamferEdgesAD( myShape, mySpinBox[ SpinBox43 ]->GetValue(), + mySpinBox[ SpinBox44 ]->GetValue() * PI180, anArray ); } - if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -687,10 +882,3 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects ) } - - - - - - - diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index 664e718be..76f06f594 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -1,92 +1,101 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : OperationGUI_ChamferDlg.h -// Author : Damien COQUERET -// Module : GEOM - -#ifndef DIALOGBOX_CHAMFER_H -#define DIALOGBOX_CHAMFER_H - -#include "GEOMBase_Skeleton.h" -#include - -class DlgRef_SpinBox; - -//================================================================================= -// class : OperationGUI_ChamferDlg -// purpose : -//================================================================================= -class OperationGUI_ChamferDlg : public GEOMBase_Skeleton -{ - Q_OBJECT - - enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces }; - enum { SpinBox1, SpinBox21, SpinBox22, SpinBox31, SpinBox32 }; - -public: - OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent); - virtual ~OperationGUI_ChamferDlg(); - -protected: - // redefined from GEOMBase_Helper - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool isValid( QString& msg ); - virtual bool execute( ObjectList& objects ); - -private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ActivateThisDialog(); - void LineEditReturnPressed(); - void SelectionIntoArgument(); - void SetEditCurrentArgument(); - void ValueChangedInSpinBox( double newValue ); - void ConstructorsClicked( int constructorId ); - -private: - void Init(); - void enterEvent( QEvent* e ); - void reset(); - void createSelWg( const QString&, QPixmap&, QWidget*, const int ); - int getConstructorId() const; - void activateSelection(); - void enableWidgets(); - -private: - int myConstructorId; - - GEOM::GEOM_Object_var myShape; - QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 ) - TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces ) - - QFrame* myGrp1; - QFrame* myGrp2; - QFrame* myGrp3; - - QMap< int, QPushButton* > mySelBtn; - QMap< int, QLineEdit* > mySelName; - QMap< int, DlgRef_SpinBox* > mySpinBox; -}; - -#endif // DIALOGBOX_CHAMFER_H +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : OperationGUI_ChamferDlg.h +// Author : Damien COQUERET +// Module : GEOM + +#ifndef DIALOGBOX_CHAMFER_H +#define DIALOGBOX_CHAMFER_H + +#include "GEOMBase_Skeleton.h" +#include + +class DlgRef_SpinBox; + +//================================================================================= +// class : OperationGUI_ChamferDlg +// purpose : +//================================================================================= +class OperationGUI_ChamferDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + + enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces, MainObj4, Edges}; + enum { SpinBox1, + SpinBox21, SpinBox22, SpinBox23, SpinBox24, + SpinBox31, SpinBox32, SpinBox33, SpinBox34, + SpinBox41, SpinBox42, SpinBox43, SpinBox44 }; + enum { RadioButton21, RadioButton22, + RadioButton31, RadioButton32, + RadioButton41, RadioButton42 }; +public: + OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent); + virtual ~OperationGUI_ChamferDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& msg ); + virtual bool execute( ObjectList& objects ); + +private slots: + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void RadioButtonPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox( double newValue ); + void ConstructorsClicked( int constructorId ); + +private: + void Init(); + void enterEvent( QEvent* e ); + void reset(); + void createSelWg( const QString&, QPixmap&, QWidget*, const int ); + int getConstructorId() const; + void activateSelection(); + void enableWidgets(); + +private: + int myConstructorId; + + GEOM::GEOM_Object_var myShape; + QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 ) + TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces ) + TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges) + + QFrame* myGrp1; + QFrame* myGrp2; + QFrame* myGrp3; + QFrame* myGrp4; + + QMap< int, QPushButton* > mySelBtn; + QMap< int, QLineEdit* > mySelName; + QMap< int, DlgRef_SpinBox* > mySpinBox; + QMap< int, QRadioButton* > myRadioButton; +}; + +#endif // DIALOGBOX_CHAMFER_H diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index e4808de4e..76aae8dc0 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -28,7 +28,7 @@ #include "OperationGUI_FilletDlg.h" #include "DlgRef_1Sel1Spin.h" -#include "DlgRef_2Sel1Spin.h" +#include "DlgRef_2Sel3Spin2Rb.h" #include "SUIT_Desktop.h" #include "SUIT_Session.h" @@ -79,21 +79,25 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid Group1->PushButton1->setPixmap( iconSelect ); Group1->LineEdit1->setReadOnly( true ); - Group2 = new DlgRef_2Sel1Spin( this, "Group2" ); + Group2 = new DlgRef_2Sel3Spin2Rb( this, "Group2" ); Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) ); Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) ); Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); + Group2->TextLabel4->setText( tr( "GEOM_R1" ) ); + Group2->TextLabel5->setText( tr( "GEOM_R2" ) ); Group2->PushButton1->setPixmap( iconSelect ); Group2->PushButton2->setPixmap( iconSelect ); Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true ); - Group3 = new DlgRef_2Sel1Spin( this, "Group3" ); + Group3 = new DlgRef_2Sel3Spin2Rb( this, "Group3" ); Group3->GroupBox1->setTitle(tr( "GEOM_FILLET_FACES" ) ); Group3->TextLabel1->setText(tr( "GEOM_MAIN_OBJECT" ) ); Group3->TextLabel2->setText(tr( "SELECTED_FACES" ) ); Group3->TextLabel3->setText(tr( "GEOM_RADIUS" ) ); + Group3->TextLabel4->setText(tr( "GEOM_R1" ) ); + Group3->TextLabel5->setText(tr( "GEOM_R2" ) ); Group3->PushButton1->setPixmap( iconSelect ); Group3->PushButton2->setPixmap( iconSelect ); Group3->LineEdit1->setReadOnly( true ); @@ -107,7 +111,11 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid double SpecificStep = 10.0; Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group2->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group2->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group3->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group3->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); setHelpFileName("fillet.htm"); @@ -158,7 +166,17 @@ void OperationGUI_FilletDlg::Init() // spin boxes connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + //RadioButtons + connect( Group2->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) ); + connect( Group2->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) ); + connect( Group3->RadioButton1, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) ); + connect( Group3->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButton_Clicked() ) ); // selection connect(myGeomGUI->getApp()->selectionMgr(), @@ -189,10 +207,18 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId ) return; // Get radius from previous widget - double R = 5; + double R = 5, R1 = 5, R2 = 5; if ( myConstructorId == 0 ) R = Group1->SpinBox_DX->GetValue(); - else if ( myConstructorId == 1 ) R = Group2->SpinBox_DX->GetValue(); - else R = Group3->SpinBox_DX->GetValue(); + else if ( myConstructorId == 1 ) { + R = Group2->SpinBox_DX->GetValue(); + R1 = Group2->SpinBox_DY->GetValue(); + R2 = Group2->SpinBox_DZ->GetValue(); + } + else { + R = Group3->SpinBox_DX->GetValue(); + R1 = Group3->SpinBox_DY->GetValue(); + R2 = Group3->SpinBox_DZ->GetValue(); + } myConstructorId = constructorId; @@ -209,12 +235,16 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId ) Group2->show(); Group3->hide(); Group2->SpinBox_DX->SetValue( R ); + Group2->SpinBox_DY->SetValue( R1 ); + Group2->SpinBox_DZ->SetValue( R2 ); break; case 2: Group1->hide(); Group2->hide(); Group3->show(); Group3->SpinBox_DX->SetValue( R ); + Group3->SpinBox_DY->SetValue( R1 ); + Group3->SpinBox_DZ->SetValue( R2 ); break; default: break; @@ -444,7 +474,11 @@ void OperationGUI_FilletDlg::reset() // Set Initial values of spinboxes Group1->SpinBox_DX->SetValue( 5 ); Group2->SpinBox_DX->SetValue( 5 ); + Group2->SpinBox_DY->SetValue( 5 ); + Group2->SpinBox_DZ->SetValue( 5 ); Group3->SpinBox_DX->SetValue( 5 ); + Group3->SpinBox_DY->SetValue( 5 ); + Group3->SpinBox_DZ->SetValue( 5 ); Group1->LineEdit1->setText( "" ); Group2->LineEdit1->setText( "" ); @@ -572,8 +606,7 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects ) int anId = getConstructorId(); if ( anId == 0 ) anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeFilletAll( myShape, - getRadius() ); + getOperation() )->MakeFilletAll( myShape, getRadius() ); else if ( anId == 1 ) { GEOM::ListOfLong_var aList = new GEOM::ListOfLong; @@ -581,9 +614,14 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects ) for ( int i = 1, n = myEdges.Extent(); i <= n; i++ ) aList[ i - 1 ] = myEdges( i ); - - anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeFilletEdges( myShape, getRadius(), aList ); + if ( Group2->RadioButton1->isChecked() ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletEdges( myShape, getRadius(), aList ); + else + anObj = GEOM::GEOM_ILocalOperations::_narrow( getOperation() )->MakeFilletEdgesR1R2( myShape, + (Group2->SpinBox_DY->GetValue()), + (Group2->SpinBox_DZ->GetValue()), + aList ); } else if ( anId == 2 ) { @@ -593,9 +631,13 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects ) for ( int i = 1, n = myFaces.Extent(); i <= n; i++ ) aList[ i - 1 ] = myFaces( i ); - - anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeFilletFaces( myShape, getRadius(), aList ); + if ( Group3->RadioButton1->isChecked() ) + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletFaces( myShape, getRadius(), aList ); + else + anObj = GEOM::GEOM_ILocalOperations::_narrow( + getOperation() )->MakeFilletFacesR1R2( myShape, (Group3->SpinBox_DY->GetValue()), + (Group3->SpinBox_DZ->GetValue()), aList ); } if ( !anObj->_is_nil() ) @@ -615,3 +657,26 @@ double OperationGUI_FilletDlg::getRadius() const else if ( anId == 1 ) return Group2->SpinBox_DX->GetValue(); else return Group3->SpinBox_DX->GetValue(); } + +//================================================================================= +// function : RadiobuttonClicked +// purpose : +//================================================================================= + +void OperationGUI_FilletDlg::RadioButton_Clicked() +{ + bool flag = ( (Group2->RadioButton1->isChecked()) && (Group3->RadioButton1->isChecked()) ); + flag = !flag; + + Group2->SpinBox_DX->setEnabled(flag); + Group2->SpinBox_DY->setEnabled(!flag); + Group2->SpinBox_DZ->setEnabled(!flag); + Group2->RadioButton1->setChecked(flag); + Group2->RadioButton2->setChecked(!flag); + Group3->SpinBox_DX->setEnabled(flag); + Group3->SpinBox_DY->setEnabled(!flag); + Group3->SpinBox_DZ->setEnabled(!flag); + Group3->RadioButton1->setChecked(flag); + Group3->RadioButton2->setChecked(!flag); + displayPreview(); +} diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index ab55f1469..c89491baf 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -33,7 +33,7 @@ #include class DlgRef_1Sel1Spin; -class DlgRef_2Sel1Spin; +class DlgRef_2Sel3Spin2Rb; //================================================================================= // class : OperationGUI_FilletDlg @@ -62,6 +62,7 @@ private slots: void SetEditCurrentArgument(); void ValueChangedInSpinBox( double newValue ); void ConstructorsClicked( int constructorId ); + void RadioButton_Clicked(); private: void Init(); @@ -80,8 +81,8 @@ private: TColStd_IndexedMapOfInteger myFaces; DlgRef_1Sel1Spin* Group1; - DlgRef_2Sel1Spin* Group2; - DlgRef_2Sel1Spin* Group3; + DlgRef_2Sel3Spin2Rb* Group2; + DlgRef_2Sel3Spin2Rb* Group3; }; #endif // DIALOGBOX_FILLET_H -- 2.39.2