From 418e3b699954e24ecda2d1cb98aa96afccc4c0e0 Mon Sep 17 00:00:00 2001 From: skl Date: Thu, 3 Apr 2008 12:16:58 +0000 Subject: [PATCH] Changes for bug NPAL15938. --- idl/GEOM_Gen.idl | 65 ++++ resources/Makefile.am | 1 + resources/pointonface.png | Bin 0 -> 616 bytes src/BasicGUI/BasicGUI_PointDlg.cxx | 95 +++++- src/BasicGUI/BasicGUI_PointDlg.h | 5 + src/DlgRef/DlgRef_Skeleton_QTD.cxx | 5 +- src/DlgRef/DlgRef_Skeleton_QTD.h | 3 +- src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui | 6 + src/GEOMBase/GEOMBase_Skeleton.cxx | 1 + src/GEOMGUI/GEOM_images.po | 4 + src/GEOMGUI/GEOM_msg_en.po | 4 + src/GEOMGUI/GEOM_msg_fr.po | 4 + src/GEOMImpl/GEOMImpl_IBasicOperations.cxx | 58 ++++ src/GEOMImpl/GEOMImpl_IBasicOperations.hxx | 4 + src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx | 318 +++++++++++++++++++ src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx | 24 ++ src/GEOMImpl/GEOMImpl_IPoint.hxx | 7 + src/GEOMImpl/GEOMImpl_PointDriver.cxx | 32 +- src/GEOMImpl/GEOMImpl_Types.hxx | 1 + src/GEOM_I/GEOM_IBasicOperations_i.cc | 34 ++ src/GEOM_I/GEOM_IBasicOperations_i.hh | 4 + src/GEOM_I/GEOM_IMeasureOperations_i.cc | 148 +++++++++ src/GEOM_I/GEOM_IMeasureOperations_i.hh | 22 ++ src/GEOM_SWIG/geompyDC.py | 47 +++ 24 files changed, 882 insertions(+), 10 deletions(-) create mode 100755 resources/pointonface.png diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index a01948267..32ead5db9 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -287,6 +287,18 @@ module GEOM GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, in double theParameter); + /*! + * Create a point, corresponding to the given parameters on the + * given surface. + * \param theRefSurf The referenced surface. + * \param theUParameter Value of U-parameter on the referenced surface. + * \param theVParameter Value of V-parameter on the referenced surface. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakePointOnSurface (in GEOM_Object theRefSurf, + in double theUParameter, + in double theVParameter); + /*! * Create a point, on two lines intersection. * \param theRefLine1, theRefLine2 The referenced lines. @@ -2543,6 +2555,59 @@ module GEOM * Get point coordinates */ void PointCoordinates (in GEOM_Object theShape, out double X, out double Y, out double Z); + + /*! + * Get radius of curvature of curve in the point determinated by param + * \param theShape - curve. + * \param theParam - parameter on curve + * \return Value of curvature. + */ + double CurveCurvatureByParam (in GEOM_Object theShape, in double theParam); + + /*! + * Get radius of curvature of curve in the given point + * \param theShape - curve. + * \param thePoint - point + * \return Value of curvature. + */ + double CurveCurvatureByPoint (in GEOM_Object theShape, in GEOM_Object thePoint); + + /*! + * Get max radius of curvature of surface in the point determinated by params + * \param theShape - surface. + * \param theUParam - U-parameter on surface + * \param theVParam - V-parameter on surface + * \return Value of curvature. + */ + double MaxSurfaceCurvatureByParam (in GEOM_Object theShape, in double theUParam, + in double theVParam); + + /*! + * Get max radius of curvature of surface in the given point + * \param theShape - surface. + * \param thePoint - point + * \return Value of curvature. + */ + double MaxSurfaceCurvatureByPoint (in GEOM_Object theShape, in GEOM_Object thePoint); + + /*! + * Get min radius of curvature of surface in the point determinated by params + * \param theShape - surface. + * \param theUParam - U-parameter on surface + * \param theVParam - V-parameter on surface + * \return Value of curvature. + */ + double MinSurfaceCurvatureByParam (in GEOM_Object theShape, in double theUParam, + in double theVParam); + + /*! + * Get min radius of curvature of surface in the given point + * \param theShape - surface. + * \param thePoint - point + * \return Value of curvature. + */ + double MinSurfaceCurvatureByPoint (in GEOM_Object theShape, in GEOM_Object thePoint); + }; diff --git a/resources/Makefile.am b/resources/Makefile.am index fdb978a29..b626ff86d 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -118,6 +118,7 @@ planeworkingvector.png \ planeworkingorigin.png \ point2.png \ pointonedge.png \ +pointonface.png \ point_line_intersection.png \ polyline.png \ prism.png \ diff --git a/resources/pointonface.png b/resources/pointonface.png new file mode 100755 index 0000000000000000000000000000000000000000..fa0f8cb4256162910575c3c241213db52d68d3f7 GIT binary patch literal 616 zcmV-u0+;=XP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ--bqA3RCwBA{Qv(y12q9a05LI882|(j)eQs)AgUV( z5I|Hn5Fmi4ZXiGaI>{6X02l;f+rRRB5Fjud?G%sLiO9t5*#r^Y|A5S#RTa8>7!h!H zs47GR%nUP|?g=19T!tAWHZ%PB_n+a{-~V9x?>`10hOmDE#lHUh%kT+^zkK`7@axM5 zhHd$FAgzi30fb>-baeE8qqJ_Irhg1S|NLjDh%#jO^IVF7Me-R#$?Q`Mzkp(2fByx$ z@aLy@3_m}=XV_OC4APne#6JK6hy~d&4-b$3D)Ai*FTVi2^y?qPH=st4VITmapDz5w z@aM-jhF@Plf(`l&q>uGyf~1>)SQ3cu0|XGRp#qb&El^@@}F#P`Z z3G6bM3*V<-W%%>+8&Lc+!|(5(8P3nIhZ*(*WEc>i2M8drmt|yR{yX;`VE6(w2xRlm zPj7(X@)4~0-|wFc|3DG)=Qj}lV)*;(2M~W}xV)kp!!RIz01!ZotgNj6L9s>#z%UHN z2M8dL3ps#T0f-Gju>|E4127B&2?7KV3)BEXsG{d2xbOoIUq?0!1ONgE=0X7yT!!qz z56Fgr06+jSQoB3^2q3EGWq<&px`6-zM0EoJ0t^7c=resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_LINES"))); + QPixmap image5(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_FACE"))); setCaption(tr("GEOM_POINT_TITLE")); @@ -82,6 +83,8 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren RadioButton3->setPixmap(image1); RadioButton4->show(); RadioButton4->setPixmap(image4); + RadioButton5->show(); + RadioButton5->setPixmap(image5); GroupXYZ = new DlgRef_3Spin( aFrame, "GroupXYZ" ); GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES")); @@ -95,6 +98,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren GroupOnCurve->TextLabel2->setText(tr("GEOM_PARAMETER")); GroupOnCurve->PushButton1->setPixmap(image2); + GroupOnSurface = new DlgRef_1Sel2Spin( aFrame, "GroupOnSurface" ); + GroupOnSurface->GroupBox1->setTitle(tr("GEOM_PARAM_POINT")); + GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE")); + GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER")); + GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER")); + GroupOnSurface->PushButton1->setPixmap(image2); + GroupRefPoint = new DlgRef_1Sel3Spin( aFrame, "GoupRefPoint" ); GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT")); GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT")); @@ -156,6 +166,7 @@ BasicGUI_PointDlg::~BasicGUI_PointDlg() void BasicGUI_PointDlg::Init() { GroupOnCurve->LineEdit1->setReadOnly( true ); + GroupOnSurface->LineEdit1->setReadOnly( true ); GroupRefPoint->LineEdit1->setReadOnly( true ); GroupLineIntersection->LineEdit1->setReadOnly( true ); GroupLineIntersection->LineEdit2->setReadOnly( true ); @@ -188,6 +199,11 @@ void BasicGUI_PointDlg::Init() GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY); GroupOnCurve->SpinBox_DX->SetValue( 0.5 ); + GroupOnSurface->SpinBox_DX->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY); + GroupOnSurface->SpinBox_DX->SetValue( 0.5 ); + GroupOnSurface->SpinBox_DY->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY); + GroupOnSurface->SpinBox_DY->SetValue( 0.5 ); + /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -199,12 +215,16 @@ void BasicGUI_PointDlg::Init() connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupOnCurve->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupOnSurface->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupLineIntersection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupLineIntersection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupLineIntersection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupLineIntersection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupXYZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupXYZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); @@ -214,6 +234,10 @@ void BasicGUI_PointDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupOnSurface->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), + GroupOnSurface->SpinBox_DY, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), @@ -253,6 +277,7 @@ void BasicGUI_PointDlg::ConstructorsClicked (int constructorId) GroupOnCurve->hide(); GroupLineIntersection->hide(); GroupXYZ->show(); + GroupOnSurface->hide(); myCoordGrp->hide(); break; } @@ -268,6 +293,7 @@ void BasicGUI_PointDlg::ConstructorsClicked (int constructorId) GroupOnCurve->hide(); GroupRefPoint->show(); GroupLineIntersection->hide(); + GroupOnSurface->hide(); myCoordGrp->show(); break; } @@ -283,6 +309,7 @@ void BasicGUI_PointDlg::ConstructorsClicked (int constructorId) GroupRefPoint->hide(); GroupOnCurve->show(); GroupLineIntersection->hide(); + GroupOnSurface->hide(); myCoordGrp->show(); break; } @@ -300,9 +327,26 @@ void BasicGUI_PointDlg::ConstructorsClicked (int constructorId) GroupRefPoint->hide(); GroupOnCurve->hide(); GroupLineIntersection->show(); + GroupOnSurface->hide(); myCoordGrp->hide(); break; } + case 4: + { + myEditCurrentArgument = GroupOnSurface->LineEdit1; + myEditCurrentArgument->setText(""); + myFace = GEOM::GEOM_Object::_nil(); + + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + + GroupXYZ->hide(); + GroupRefPoint->hide(); + GroupOnCurve->hide(); + GroupLineIntersection->hide(); + GroupOnSurface->show(); + myCoordGrp->show(); + break; + } } myX->setText( "" ); @@ -357,13 +401,13 @@ void BasicGUI_PointDlg::SelectionIntoArgument() { const int id = getConstructorId(); - if ((id == 1 || id == 2) && myEditCurrentArgument != 0) + if ((id == 1 || id == 2 || id == 4 ) && myEditCurrentArgument != 0) { myEditCurrentArgument->setText(""); myX->setText( "" ); myY->setText( "" ); myZ->setText( "" ); - myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); + myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil(); } if (IObjectCount() == 1) @@ -381,6 +425,8 @@ void BasicGUI_PointDlg::SelectionIntoArgument() TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if (id == 2 || id == 3) aNeedType = TopAbs_EDGE; + if(id == 4) + aNeedType = TopAbs_FACE; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; @@ -442,6 +488,11 @@ void BasicGUI_PointDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aName); } } + else if (id == 4) + { + myFace = aSelectedObject; + GroupOnSurface->LineEdit1->setText(aName); + } } } @@ -488,6 +539,13 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } + else if ( send == GroupOnSurface->PushButton1 ) + { + GroupOnSurface->LineEdit1->setFocus(); + myEditCurrentArgument = GroupOnSurface->LineEdit1; + + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + } else if ( send == GroupLineIntersection->PushButton1 ) { GroupLineIntersection->LineEdit1->setFocus(); @@ -553,6 +611,27 @@ double BasicGUI_PointDlg::getParameter() const return GroupOnCurve->SpinBox_DX->GetValue(); } + +//================================================================================= +// funcion : getUParameter() +// purpose : +//================================================================================= +double BasicGUI_PointDlg::getUParameter() const +{ + return GroupOnSurface->SpinBox_DX->GetValue(); +} + + +//================================================================================= +// funcion : getVParameter() +// purpose : +//================================================================================= +double BasicGUI_PointDlg::getVParameter() const +{ + return GroupOnSurface->SpinBox_DY->GetValue(); +} + + //================================================================================= // function : OnPointSelected // purpose : @@ -593,6 +672,8 @@ bool BasicGUI_PointDlg::isValid( QString& msg ) return !myEdge->_is_nil(); else if ( id == 3) return ( !myLine1->_is_nil() && !myLine2->_is_nil() ); + else if ( id == 4 ) + return !myFace->_is_nil(); return false; } @@ -639,6 +720,11 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) MakePointOnLinesIntersection( myLine1, myLine2 ); res = true; break; + case 4 : + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> + MakePointOnSurface( myFace, getUParameter(), getVParameter() ); + res = true; + break; } if ( getConstructorId() == 1 || getConstructorId() == 2 ) @@ -685,7 +771,7 @@ void BasicGUI_PointDlg::addSubshapesToStudy() { QMap objMap; -switch (getConstructorId()) + switch (getConstructorId()) { case 0: break; @@ -699,6 +785,9 @@ switch (getConstructorId()) objMap[GroupLineIntersection->LineEdit1->text()] = myLine1; objMap[GroupLineIntersection->LineEdit2->text()] = myLine2; break; + case 4: + objMap[GroupOnSurface->LineEdit1->text()] = myFace; + break; } addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index 8a19f1ab9..d54e89946 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -35,6 +35,7 @@ #include "DlgRef_3Spin.h" #include "DlgRef_2Sel_QTD.h" #include "DlgRef_1Sel3Spin.h" +#include "DlgRef_1Sel2Spin.h" class QLineEdit; class QGroupBox; @@ -68,8 +69,11 @@ private : void Init(); void enterEvent(QEvent* e); double getParameter() const; + double getUParameter() const; + double getVParameter() const; GEOM::GEOM_Object_var myEdge; + GEOM::GEOM_Object_var myFace; GEOM::GEOM_Object_var myRefPoint; GEOM::GEOM_Object_var myLine1; GEOM::GEOM_Object_var myLine2; @@ -78,6 +82,7 @@ private : DlgRef_1Sel3Spin* GroupRefPoint; DlgRef_1Sel1Spin* GroupOnCurve; DlgRef_2Sel_QTD* GroupLineIntersection; + DlgRef_1Sel2Spin* GroupOnSurface; QGroupBox* myCoordGrp; QLineEdit* myX; diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.cxx b/src/DlgRef/DlgRef_Skeleton_QTD.cxx index 9ff558c8c..24b2dff0e 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.cxx +++ b/src/DlgRef/DlgRef_Skeleton_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: Wed Mar 26 12:14:14 2008 +** Created: Wed Apr 2 16:42:12 2008 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -60,6 +60,9 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, boo RadioButton4 = new QRadioButton( GroupConstructors, "RadioButton4" ); Layout2->addWidget( RadioButton4 ); + + RadioButton5 = new QRadioButton( GroupConstructors, "RadioButton5" ); + Layout2->addWidget( RadioButton5 ); GroupConstructorsLayout->addLayout( Layout2 ); Layout1->addWidget( GroupConstructors, 0, 0 ); diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.h b/src/DlgRef/DlgRef_Skeleton_QTD.h index f197e914c..f89674f3a 100644 --- a/src/DlgRef/DlgRef_Skeleton_QTD.h +++ b/src/DlgRef/DlgRef_Skeleton_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui' ** -** Created: Wed Mar 26 12:14:12 2008 +** Created: Wed Apr 2 16:42:12 2008 ** by: The User Interface Compiler ($Id$) ** ** WARNING! All changes made in this file will be lost! @@ -38,6 +38,7 @@ public: QRadioButton* RadioButton2; QRadioButton* RadioButton3; QRadioButton* RadioButton4; + QRadioButton* RadioButton5; QGroupBox* GroupBoxName; QLabel* NameLabel; QLineEdit* ResultName; diff --git a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui index 4e6826996..ee0c76234 100644 --- a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui @@ -103,6 +103,11 @@ RadioButton4 + + + RadioButton5 + + @@ -145,6 +150,7 @@ ResultName + diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 4507dc644..0d24030c9 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -113,6 +113,7 @@ void GEOMBase_Skeleton::Init() /* displays Dialog */ RadioButton1->setChecked(TRUE); RadioButton4->hide(); + RadioButton5->hide(); CheckBoxRestoreSS->setChecked(FALSE); GroupBoxPublish->hide(); diff --git a/src/GEOMGUI/GEOM_images.po b/src/GEOMGUI/GEOM_images.po index 74a30836e..d98a54226 100644 --- a/src/GEOMGUI/GEOM_images.po +++ b/src/GEOMGUI/GEOM_images.po @@ -185,6 +185,10 @@ msgstr "point3.png" msgid "ICON_DLG_POINT_EDGE" msgstr "pointonedge.png" +#PointDlg +msgid "ICON_DLG_POINT_FACE" +msgstr "pointonface.png" + #PoinDlg msgid "ICON_DLG_POINT_LINES" msgstr "point_line_intersection.png" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index c694fae09..0fe6565b3 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -790,6 +790,10 @@ msgstr "Imported_Shape" #Parameter msgid "GEOM_PARAMETER" msgstr "Parameter :" +msgid "GEOM_UPARAMETER" +msgstr "U-parameter :" +msgid "GEOM_VPARAMETER" +msgstr "V-parameter :" # #============================================================================== diff --git a/src/GEOMGUI/GEOM_msg_fr.po b/src/GEOMGUI/GEOM_msg_fr.po index 0c4df972c..999fea701 100644 --- a/src/GEOMGUI/GEOM_msg_fr.po +++ b/src/GEOMGUI/GEOM_msg_fr.po @@ -722,6 +722,10 @@ msgstr "Wire(s)" #Parameter msgid "GEOM_PARAMETER" msgstr "Paramètre :" +msgid "GEOM_UPARAMETER" +msgstr "U-paramètre :" +msgid "GEOM_VPARAMETER" +msgstr "V-paramètre :" # diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index 08d1fde18..323a17bbb 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -231,6 +231,64 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve return aPoint; } + +//============================================================================= +/*! + * MakePointOnSurface + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface + (Handle(GEOM_Object) theSurface, double theUParameter, double theVParameter) +{ + SetErrorCode(KO); + + if (theSurface.IsNull()) return NULL; + + //Add a new Point object + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + + //Add a new Point function for creation a point relativley another point + Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), + POINT_SURFACE_PAR); + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL; + + GEOMImpl_IPoint aPI (aFunction); + + Handle(GEOM_Function) aRefFunction = theSurface->GetLastFunction(); + if (aRefFunction.IsNull()) return NULL; + + aPI.SetSurface(aRefFunction); + aPI.SetParameter(theUParameter); + aPI.SetParameter2(theVParameter); + + //Compute the point value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Point driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface(" + << theSurface << ", " << theUParameter + << ", " << theVParameter << ")"; + + SetErrorCode(OK); + return aPoint; +} + + //============================================================================= /*! * MakePointOnLinesIntersection diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx index e6155178b..4fdf59716 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx @@ -44,6 +44,10 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePointOnLinesIntersection (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2); + Standard_EXPORT Handle(GEOM_Object) MakePointOnSurface (Handle(GEOM_Object) theSurface, + double theUParameter, + double theVParameter); + // Vector Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ); diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index 67e26c014..530fd36fe 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -87,6 +87,12 @@ #include #include +#include +#include +#include +#include +#include + #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -1467,6 +1473,317 @@ Standard_Real GEOMImpl_IMeasureOperations::GetAngle (Handle(GEOM_Object) theLine return anAngle; } + +//============================================================================= +/*! + * CurveCurvatureByParam + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByParam + (Handle(GEOM_Object) theCurve, Standard_Real& theParam) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if(theCurve.IsNull()) return aRes; + + Handle(GEOM_Function) aRefShape = theCurve->GetLastFunction(); + if(aRefShape.IsNull()) return aRes; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if(aShape.IsNull()) { + SetErrorCode("One of Objects has NULL Shape"); + return aRes; + } + + Standard_Real aFP, aLP, aP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP); + aP = aFP + (aLP - aFP) * theParam; + + if(aCurve.IsNull()) return aRes; + + //Compute curvature + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + GeomLProp_CLProps Prop = GeomLProp_CLProps + (aCurve, aP, 2, Precision::Confusion()); + aRes = fabs(Prop.Curvature()); + SetErrorCode(OK); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return aRes; + } + + if( aRes > Precision::Confusion() ) + aRes = 1/aRes; + else + aRes = RealLast(); + + return aRes; +} + + +//============================================================================= +/*! + * CurveCurvatureByPoint + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByPoint + (Handle(GEOM_Object) theCurve, Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if( theCurve.IsNull() || thePoint.IsNull() ) return aRes; + + Handle(GEOM_Function) aRefCurve = theCurve->GetLastFunction(); + Handle(GEOM_Function) aRefPoint = thePoint->GetLastFunction(); + if( aRefCurve.IsNull() || aRefPoint.IsNull() ) return aRes; + + TopoDS_Edge anEdge = TopoDS::Edge(aRefCurve->GetValue()); + TopoDS_Vertex aPnt = TopoDS::Vertex(aRefPoint->GetValue()); + if( anEdge.IsNull() || aPnt.IsNull() ) { + SetErrorCode("One of Objects has NULL Shape"); + return aRes; + } + + Standard_Real aFP, aLP; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFP, aLP); + if(aCurve.IsNull()) return aRes; + gp_Pnt aPoint = BRep_Tool::Pnt(aPnt); + + //Compute curvature + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + GeomAPI_ProjectPointOnCurve PPC(aPoint, aCurve, aFP, aLP); + if(PPC.NbPoints()>0) { + GeomLProp_CLProps Prop = GeomLProp_CLProps + (aCurve, PPC.LowerDistanceParameter(), 2, Precision::Confusion()); + aRes = fabs(Prop.Curvature()); + SetErrorCode(OK); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return aRes; + } + + if( aRes > Precision::Confusion() ) + aRes = 1/aRes; + else + aRes = RealLast(); + + return aRes; +} + + +//============================================================================= +/*! + * getSurfaceCurvatures + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::getSurfaceCurvatures + (const Handle(Geom_Surface)& aSurf, + Standard_Real theUParam, + Standard_Real theVParam, + Standard_Boolean theNeedMaxCurv) +{ + SetErrorCode(KO); + Standard_Real aRes = 1.0; + + if (aSurf.IsNull()) return aRes; + + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + GeomLProp_SLProps Prop = GeomLProp_SLProps + (aSurf, theUParam, theVParam, 2, Precision::Confusion()); + if(Prop.IsCurvatureDefined()) { + if(Prop.IsUmbilic()) { + //cout<<"is umbilic"<GetMessageString()); + return aRes; + } + + if( fabs(aRes) > Precision::Confusion() ) + aRes = 1/aRes; + else + aRes = RealLast(); + + return aRes; +} + + +//============================================================================= +/*! + * MaxSurfaceCurvatureByParam + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::MaxSurfaceCurvatureByParam + (Handle(GEOM_Object) theSurf, + Standard_Real& theUParam, + Standard_Real& theVParam) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if (theSurf.IsNull()) return aRes; + + Handle(GEOM_Function) aRefShape = theSurf->GetLastFunction(); + if(aRefShape.IsNull()) return aRes; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if(aShape.IsNull()) { + SetErrorCode("One of Objects has NULL Shape"); + return aRes; + } + + TopoDS_Face F = TopoDS::Face(aShape); + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F); + + //Compute the parameters + Standard_Real U1,U2,V1,V2; + ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2); + Standard_Real U = U1 + (U2-U1)*theUParam; + Standard_Real V = V1 + (V2-V1)*theVParam; + + return getSurfaceCurvatures(aSurf, U, V, true); +} + + +//============================================================================= +/*! + * MaxSurfaceCurvatureByPoint + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::MaxSurfaceCurvatureByPoint + (Handle(GEOM_Object) theSurf, Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if( theSurf.IsNull() || thePoint.IsNull() ) return aRes; + + Handle(GEOM_Function) aRefShape = theSurf->GetLastFunction(); + Handle(GEOM_Function) aRefPoint = thePoint->GetLastFunction(); + if( aRefShape.IsNull() || aRefPoint.IsNull() ) return aRes; + + TopoDS_Face aFace = TopoDS::Face(aRefShape->GetValue()); + TopoDS_Vertex aPnt = TopoDS::Vertex(aRefPoint->GetValue()); + if( aFace.IsNull() || aPnt.IsNull() ) { + SetErrorCode("One of Objects has NULL Shape"); + return 0; + } + + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); + if(aSurf.IsNull()) return aRes; + gp_Pnt aPoint = BRep_Tool::Pnt(aPnt); + + //Compute the parameters + ShapeAnalysis_Surface sas(aSurf); + gp_Pnt2d UV = sas.ValueOfUV(aPoint,Precision::Confusion()); + + return getSurfaceCurvatures(aSurf, UV.X(), UV.Y(), true); +} + + +//============================================================================= +/*! + * MinSurfaceCurvatureByParam + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::MinSurfaceCurvatureByParam + (Handle(GEOM_Object) theSurf, + Standard_Real& theUParam, + Standard_Real& theVParam) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if (theSurf.IsNull()) return aRes; + + Handle(GEOM_Function) aRefShape = theSurf->GetLastFunction(); + if(aRefShape.IsNull()) return aRes; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if(aShape.IsNull()) { + SetErrorCode("One of Objects has NULL Shape"); + return aRes; + } + + TopoDS_Face F = TopoDS::Face(aShape); + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F); + + //Compute the parameters + Standard_Real U1,U2,V1,V2; + ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2); + Standard_Real U = U1 + (U2-U1)*theUParam; + Standard_Real V = V1 + (V2-V1)*theVParam; + + return getSurfaceCurvatures(aSurf, U, V, false); +} + + +//============================================================================= +/*! + * MinSurfaceCurvatureByPoint + */ +//============================================================================= +Standard_Real GEOMImpl_IMeasureOperations::MinSurfaceCurvatureByPoint + (Handle(GEOM_Object) theSurf, Handle(GEOM_Object) thePoint) +{ + SetErrorCode(KO); + Standard_Real aRes = -1.0; + + if( theSurf.IsNull() || thePoint.IsNull() ) return aRes; + + Handle(GEOM_Function) aRefShape = theSurf->GetLastFunction(); + Handle(GEOM_Function) aRefPoint = thePoint->GetLastFunction(); + if( aRefShape.IsNull() || aRefPoint.IsNull() ) return aRes; + + TopoDS_Face aFace = TopoDS::Face(aRefShape->GetValue()); + TopoDS_Vertex aPnt = TopoDS::Vertex(aRefPoint->GetValue()); + if( aFace.IsNull() || aPnt.IsNull() ) { + SetErrorCode("One of Objects has NULL Shape"); + return 0; + } + + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace); + if(aSurf.IsNull()) return aRes; + gp_Pnt aPoint = BRep_Tool::Pnt(aPnt); + + //Compute the parameters + ShapeAnalysis_Surface sas(aSurf); + gp_Pnt2d UV = sas.ValueOfUV(aPoint,Precision::Confusion()); + + return getSurfaceCurvatures(aSurf, UV.X(), UV.Y(), false); +} + + //======================================================================= //function : StructuralDump //purpose : Structural (data exchange) style of output. @@ -1709,6 +2026,7 @@ void GEOMImpl_IMeasureOperations::StructuralDump (const BRepCheck_Analyzer& theA } } + //======================================================================= //function : GetProblemShapes // purpose : for StructuralDump diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index 24f6e5253..50a596854 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -31,6 +31,7 @@ #include #include #include +#include class GEOM_Engine; class Handle(GEOM_Object); @@ -130,6 +131,24 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2); + + // Methods for recieving radiuses of curvature of curves and surfaces + // in the given point + Standard_EXPORT Standard_Real CurveCurvatureByParam (Handle(GEOM_Object) theCurve, + Standard_Real& theParam); + Standard_EXPORT Standard_Real CurveCurvatureByPoint (Handle(GEOM_Object) theCurve, + Handle(GEOM_Object) thePoint); + Standard_EXPORT Standard_Real MaxSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf, + Standard_Real& theUParam, + Standard_Real& theVParam); + Standard_EXPORT Standard_Real MaxSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf, + Handle(GEOM_Object) thePoint); + Standard_EXPORT Standard_Real MinSurfaceCurvatureByParam (Handle(GEOM_Object) theSurf, + Standard_Real& theUParam, + Standard_Real& theVParam); + Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf, + Handle(GEOM_Object) thePoint); + public: Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape); @@ -150,6 +169,11 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { Handle(TColStd_HArray1OfInteger)& NbProblems, const TopAbs_ShapeEnum Subtype, TopTools_DataMapOfShapeListOfShape& theMap); + + Standard_Real getSurfaceCurvatures (const Handle(Geom_Surface)& aSurf, + Standard_Real theUParam, + Standard_Real theVParam, + Standard_Boolean theNeedMaxCurv); }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx index b796a51f5..7b7ed39c9 100755 --- a/src/GEOMImpl/GEOMImpl_IPoint.hxx +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -33,6 +33,9 @@ #define ARG_LINE1 7 #define ARG_LINE2 8 +#define ARG_SURFACE 9 +#define ARG_PARAM2 10 + class GEOMImpl_IPoint { public: @@ -52,16 +55,20 @@ class GEOMImpl_IPoint Handle(GEOM_Function) GetRef() { return _func->GetReference(ARG_REF); } void SetCurve(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_CURVE, theRef); } + void SetSurface(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_SURFACE, theRef); } void SetLine1(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE1, theRef); } void SetLine2(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE2, theRef); } Handle(GEOM_Function) GetCurve() { return _func->GetReference(ARG_CURVE); } + Handle(GEOM_Function) GetSurface() { return _func->GetReference(ARG_SURFACE); } Handle(GEOM_Function) GetLine1() { return _func->GetReference(ARG_LINE1); } Handle(GEOM_Function) GetLine2() { return _func->GetReference(ARG_LINE2); } void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } + void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); } double GetParameter() { return _func->GetReal(ARG_PARAM); } + double GetParameter2() { return _func->GetReal(ARG_PARAM2); } private: diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index a511c53ea..cdfa4901d 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -36,7 +36,11 @@ #include #include +#include #include +#include +#include + //======================================================================= //function : GetID @@ -57,6 +61,7 @@ GEOMImpl_PointDriver::GEOMImpl_PointDriver() { } + //======================================================================= //function : Execute //purpose : @@ -74,7 +79,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const if (aType == POINT_XYZ) { aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ()); - } else if (aType == POINT_XYZ_REF) { + } + else if (aType == POINT_XYZ_REF) { Handle(GEOM_Function) aRefPoint = aPI.GetRef(); TopoDS_Shape aRefShape = aRefPoint->GetValue(); @@ -85,8 +91,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aRefShape)); aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ()); - } else if (aType == POINT_CURVE_PAR) { - + } + else if (aType == POINT_CURVE_PAR) { Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); TopoDS_Shape aRefShape = aRefCurve->GetValue(); if (aRefShape.ShapeType() != TopAbs_EDGE) { @@ -97,8 +103,24 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP); aP = aFP + (aLP - aFP) * aPI.GetParameter(); aPnt = aCurve->Value(aP); - - } else if (aType == POINT_LINES_INTERSECTION) { + } + else if (aType == POINT_SURFACE_PAR) { + Handle(GEOM_Function) aRefCurve = aPI.GetSurface(); + TopoDS_Shape aRefShape = aRefCurve->GetValue(); + if (aRefShape.ShapeType() != TopAbs_FACE) { + Standard_TypeMismatch::Raise + ("Point On Surface creation aborted : surface shape is not a face"); + } + TopoDS_Face F = TopoDS::Face(aRefShape); + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F); + Standard_Real U1,U2,V1,V2; + //aSurf->Bounds(U1,U2,V1,V2); + ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2); + Standard_Real U = U1 + (U2-U1) * aPI.GetParameter(); + Standard_Real V = V1 + (V2-V1) * aPI.GetParameter2(); + aPnt = aSurf->Value(U,V); + } + else if (aType == POINT_LINES_INTERSECTION) { Handle(GEOM_Function) aRef1 = aPI.GetLine1(); Handle(GEOM_Function) aRef2 = aPI.GetLine2(); diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 505eb37d5..987315159 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -98,6 +98,7 @@ #define POINT_XYZ_REF 2 #define POINT_CURVE_PAR 3 #define POINT_LINES_INTERSECTION 4 +#define POINT_SURFACE_PAR 5 //#define POINT_FACE_PAR 5 #define VECTOR_TWO_PNT 1 diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc index fe525509c..613e3954e 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.cc +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -138,6 +138,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection return GetObject(anObject); } + //============================================================================= /*! * MakePointOnCurve @@ -169,6 +170,39 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve return GetObject(anObject); } + +//============================================================================= +/*! + * MakePointOnSurface + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurface + (GEOM::GEOM_Object_ptr theSurface, + CORBA::Double theUParameter, + CORBA::Double theVParameter) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theSurface == NULL) return aGEOMObject._retn(); + + //Get the reference surface + Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject + (theSurface->GetStudyID(), theSurface->GetEntry()); + if (aRefernce.IsNull()) return aGEOMObject._retn(); + + //Create the point + Handle(GEOM_Object) anObject = + GetOperations()->MakePointOnSurface(aRefernce, theUParameter, theVParameter); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + //============================================================================= /*! * MakeTangentOnCurve diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh index 753e0df16..60cc657cc 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.hh +++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh @@ -53,6 +53,10 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i : GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnSurface (GEOM::GEOM_Object_ptr theSurface, + CORBA::Double theUParameter, + CORBA::Double theVParameter); + GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1, GEOM::GEOM_Object_ptr theLine2); diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index d4e8c6a8e..358dd68a0 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -473,3 +473,151 @@ CORBA::Double GEOM_IMeasureOperations_i::GetAngle (GEOM::GEOM_Object_ptr theShap // Get the angle return GetOperations()->GetAngle(aShape1, aShape2); } + + +//============================================================================= +/*! + * CurveCurvatureByParam + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByParam + (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParam) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if(theCurve==NULL) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theCurve->GetStudyID(), theCurve->GetEntry()); + + if(aShape.IsNull()) return -1.0; + + return GetOperations()->CurveCurvatureByParam(aShape,theParam); +} + + +//============================================================================= +/*! + * CurveCurvatureByPoint + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint + (GEOM::GEOM_Object_ptr theCurve, GEOM::GEOM_Object_ptr thePoint) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if( theCurve==NULL || thePoint==NULL ) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theCurve->GetStudyID(), theCurve->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; + + return GetOperations()->CurveCurvatureByPoint(aShape,aPoint); +} + + +//============================================================================= +/*! + * MaxSurfaceCurvatureByParam + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByParam + (GEOM::GEOM_Object_ptr theSurf, + CORBA::Double theUParam, + CORBA::Double theVParam) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if(theSurf==NULL) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theSurf->GetStudyID(), theSurf->GetEntry()); + + if(aShape.IsNull()) return -1.0; + + return GetOperations()->MaxSurfaceCurvatureByParam(aShape,theUParam,theVParam); +} + + +//============================================================================= +/*! + * MaxSurfaceCurvatureByPoint + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint + (GEOM::GEOM_Object_ptr theSurf, GEOM::GEOM_Object_ptr thePoint) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if( theSurf==NULL || thePoint==NULL ) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theSurf->GetStudyID(), theSurf->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; + + return GetOperations()->MaxSurfaceCurvatureByPoint(aShape,aPoint); +} + + +//============================================================================= +/*! + * MinSurfaceCurvatureByParam + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByParam + (GEOM::GEOM_Object_ptr theSurf, + CORBA::Double theUParam, + CORBA::Double theVParam) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if(theSurf==NULL) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theSurf->GetStudyID(), theSurf->GetEntry()); + + if(aShape.IsNull()) return -1.0; + + return GetOperations()->MinSurfaceCurvatureByParam(aShape,theUParam,theVParam); +} + + +//============================================================================= +/*! + * MinSurfaceCurvatureByPoint + */ +//============================================================================= +CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByPoint + (GEOM::GEOM_Object_ptr theSurf, GEOM::GEOM_Object_ptr thePoint) +{ + //Set a not done flag + GetOperations()->SetNotDone(); + + if( theSurf==NULL || thePoint==NULL ) return -1.0; + + //Get the reference shape + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theSurf->GetStudyID(), theSurf->GetEntry()); + Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject + (thePoint->GetStudyID(), thePoint->GetEntry()); + + if( aShape.IsNull() || aPoint.IsNull() ) return -1.0; + + return GetOperations()->MinSurfaceCurvatureByPoint(aShape,aPoint); +} diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh index 4db8a26d4..2a4c40fe3 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -94,6 +94,28 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i : CORBA::Double GetAngle (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2); + // Methods for recieving radiuses of curvature of curves and surfaces + // in the given point + CORBA::Double CurveCurvatureByParam (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theParam); + + CORBA::Double CurveCurvatureByPoint (GEOM::GEOM_Object_ptr theCurve, + GEOM::GEOM_Object_ptr thePoint); + + CORBA::Double MaxSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, + CORBA::Double theUParam, + CORBA::Double theVParam); + + CORBA::Double MaxSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf, + GEOM::GEOM_Object_ptr thePoint); + + CORBA::Double MinSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf, + CORBA::Double theUParam, + CORBA::Double theVParam); + + CORBA::Double MinSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf, + GEOM::GEOM_Object_ptr thePoint); + ::GEOMImpl_IMeasureOperations* GetOperations() { return (::GEOMImpl_IMeasureOperations*)GetImpl(); } }; diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 4b0a0c8e4..a190dd8a3 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -215,6 +215,19 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakePointOnCurve", self.BasicOp) return anObj + ## Create a point, corresponding to the given parameters on the + # given surface. + # @param theRefSurf The referenced surface. + # @param theUParameter Value of U-parameter on the referenced surface. + # @param theVParameter Value of V-parameter on the referenced surface. + # @return New GEOM_Object, containing the created point. + # + # Example: see GEOM_TestAll.py + def MakeVertexOnSurface(self,theRefSurf, theUParameter, theVParameter): + anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter) + RaiseIfFailed("MakePointOnSurface", self.BasicOp) + return anObj + ## Create a point on intersection of two lines. # @param theRefLine1, theRefLine2 The referenced lines. # @return New GEOM_Object, containing the created point. @@ -2109,6 +2122,40 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetAngle", self.MeasuOp) return anAngle + ## Methods for recieving radius of curvature of curves + # in the given point + # + # Example: see GEOM_TestMeasures.py + def CurveCurvatureByParam(self, theCurve, theParam): + aCurv = self.MeasuOp.CurveCurvatureByParam(theCurve,theParam) + RaiseIfFailed("CurveCurvatureByParam", self.MeasuOp) + return aCurv + def CurveCurvatureByPoint(self, theCurve, thePoint): + aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint) + RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp) + return aCurv + + ## Methods for recieving max and min radius of curvature of surfaces + # in the given point + # + # Example: see GEOM_TestMeasures.py + def MaxSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + aSurf = self.MeasuOp.MaxSurfaceCurvatureByParam(theSurf,theUParam,theVParam) + RaiseIfFailed("MaxSurfaceCurvatureByParam", self.MeasuOp) + return aSurf + def MaxSurfaceCurvatureByPoint(self, theSurf, thePoint): + aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint) + RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp) + return aSurf + def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam): + aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam) + RaiseIfFailed("MinSurfaceCurvatureByParam", self.MeasuOp) + return aSurf + def MinSurfaceCurvatureByPoint(self, theSurf, thePoint): + aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint) + RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp) + return aSurf + ## Get min and max tolerances of sub-shapes of theShape # @param theShape Shape, to get tolerances of. # @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax] -- 2.39.2