Salome HOME
Changes for bug NPAL15938.
authorskl <skl@opencascade.com>
Thu, 3 Apr 2008 12:16:58 +0000 (12:16 +0000)
committerskl <skl@opencascade.com>
Thu, 3 Apr 2008 12:16:58 +0000 (12:16 +0000)
24 files changed:
idl/GEOM_Gen.idl
resources/Makefile.am
resources/pointonface.png [new file with mode: 0755]
src/BasicGUI/BasicGUI_PointDlg.cxx
src/BasicGUI/BasicGUI_PointDlg.h
src/DlgRef/DlgRef_Skeleton_QTD.cxx
src/DlgRef/DlgRef_Skeleton_QTD.h
src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui
src/GEOMBase/GEOMBase_Skeleton.cxx
src/GEOMGUI/GEOM_images.po
src/GEOMGUI/GEOM_msg_en.po
src/GEOMGUI/GEOM_msg_fr.po
src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx
src/GEOMImpl/GEOMImpl_IPoint.hxx
src/GEOMImpl/GEOMImpl_PointDriver.cxx
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.hh
src/GEOM_I/GEOM_IMeasureOperations_i.cc
src/GEOM_I/GEOM_IMeasureOperations_i.hh
src/GEOM_SWIG/geompyDC.py

index a01948267d69fcb35b0277f2a815c6938efc5ec2..32ead5db984ac8ed4b1130771e398cc58faae010 100644 (file)
@@ -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);
+
   };
 
 
index fdb978a295bf8d3b5ec025c2837a106cc08c225a..b626ff86d606d8345f0933ee488be595766a0573 100644 (file)
@@ -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 (executable)
index 0000000..fa0f8cb
Binary files /dev/null and b/resources/pointonface.png differ
index 573e8bda857bd07bf51a38f6729d2a317a856fe6..484449ab54c6fb5daeba81715a7b7968df683bd3 100644 (file)
@@ -68,6 +68,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren
   QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
   QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF")));
   QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_LINES")));
+  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<QString, GEOM::GEOM_Object_var> 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 );
 }
index 8a19f1ab96612c2f9945ae736e658fd1ddac354b..d54e899467c8352aeee6385c48c0aa782d321c1a 100644 (file)
@@ -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;
index 9ff558c8caf19d0e46b5efbd26b34e001808e392..24b2dff0e53dd5d03ce334ec2c5e3515bfb4f1de 100644 (file)
@@ -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 );
index f197e914c45fce8236c211d4d541c8ec3392e3b3..f89674f3a1a0c407d8e70e8a8f26ef514118417a 100644 (file)
@@ -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;
index 4e6826996ea4a2a359a5e805c10ae96ac948e505..ee0c762345f8db75cbb2a9b69451827f71621228 100644 (file)
                                         <cstring>RadioButton4</cstring>
                                     </property>
                                 </widget>
+                                <widget class="QRadioButton">
+                                    <property name="name">
+                                        <cstring>RadioButton5</cstring>
+                                    </property>
+                                </widget>
                             </hbox>
                         </widget>
                     </hbox>
                                         <cstring>ResultName</cstring>
                                     </property>
                                 </widget>
+
                             </grid>
                         </widget>
                     </grid>
index 4507dc64415143bd2a1d73c40e1fec6172ab46a3..0d24030c98bd46432eb58568e003b4725fe5dab9 100644 (file)
@@ -113,6 +113,7 @@ void GEOMBase_Skeleton::Init()
   /* displays Dialog */
   RadioButton1->setChecked(TRUE);
   RadioButton4->hide();
+  RadioButton5->hide();
 
   CheckBoxRestoreSS->setChecked(FALSE);
   GroupBoxPublish->hide();
index 74a30836e6b2a987a77f8c848656badb248f85bf..d98a5422646bc533191b0c188dcb9884527da339 100644 (file)
@@ -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"
index c694fae09ece027ccf934fdf87330fdc14c42c19..0fe6565b3a7fbcbab74ff9a9c3ece6c721ebe7ce 100644 (file)
@@ -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 :"
 
 #
 #==============================================================================
index 0c4df972cdc97c609a7be3b6ac6b3f2645381a4a..999fea70174c344e9e9bde7ca5e9f039d52756db 100644 (file)
@@ -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 :"
 
 
 #
index 08d1fde184e77359d8d50259c25305b2e53edaa6..323a17bbb83a1c479480471ced2f0d1dc30b2b9b 100644 (file)
@@ -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
index e6155178bf89a67618f6cfdcce59bd0eec4e96f8..4fdf5971635853927aaeccd2107f4b60732c9fb8 100644 (file)
@@ -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);
 
index 67e26c014cc29827521856b05b77f591594396f0..530fd36fed4cbdc7ba023cf23a7fbf0fadc5ce19 100644 (file)
 #include <gp_Pln.hxx>
 #include <gp_Lin.hxx>
 
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <ShapeAnalysis.hxx>
+#include <ShapeAnalysis_Surface.hxx>
+#include <GeomLProp_CLProps.hxx>
+#include <GeomLProp_SLProps.hxx>
+
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // 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"<<endl;
+        aRes = fabs(Prop.MeanCurvature());
+      }
+      else {
+        //cout<<"is not umbilic"<<endl;
+        double c1 = fabs(Prop.MaxCurvature());
+        double c2 = fabs(Prop.MinCurvature());
+        if(theNeedMaxCurv)
+          aRes = Max(c1,c2);
+        else
+          aRes = Min(c1,c2);
+      }
+      SetErrorCode(OK);
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->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
index 24f6e52537e682ecdb602c6e918bd698cf505fb8..50a596854d389c399e951b288a24d54c674e8fe4 100644 (file)
@@ -31,6 +31,7 @@
 #include <TColStd_HSequenceOfInteger.hxx>
 #include <TColStd_HSequenceOfReal.hxx>
 #include <gp_Ax3.hxx>
+#include <Geom_Surface.hxx>
 
 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
index b796a51f5f2a9a58623a2b2d5459fd6f4e1bf635..7b7ed39c9ba29ea164c8409f55d42eed253e1e60 100755 (executable)
@@ -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:
 
index a511c53ea6cc30977f2bafb1c7e5b7238b3d965a..cdfa4901d6fced10885598b99e7b5587db383d7f 100644 (file)
 #include <TopoDS_Vertex.hxx>
 
 #include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
 #include <gp_Pnt.hxx>
+#include <TopoDS_Face.hxx>
+#include <ShapeAnalysis.hxx>
+
 
 //=======================================================================
 //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();
 
index 505eb37d51b76207834592847fb2ee01ebb758b9..9873151596041af3e10c939a7eb3805845cea282 100755 (executable)
@@ -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
index fe525509c27373495937fae0c32f2ba904f62d13..613e3954e5bbde2948169780a501186c8bae63ae 100644 (file)
@@ -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
index 753e0df1660e088c10fab0cf7350e49434a2de80..60cc657cc30393816672272160d554fdfeec659a 100644 (file)
@@ -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);
 
index d4e8c6a8e67fc9bf8d9c74c332c330794d5b48f6..358dd68a08e85ab75949ad03d672f25fb9c46d64 100644 (file)
@@ -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);
+}
index 4db8a26d410dac87a029955a3ef29e1482207c14..2a4c40fe3cd20478265db7ff5d7584a0a379ab55 100644 (file)
@@ -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(); }
 };
index 4b0a0c8e45236e407b64c61c827f70d87d6ed4a8..a190dd8a3755307be110eac90e34230fac0cbf0d 100644 (file)
@@ -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]