Salome HOME
Preparation of intermediate revision
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBasicOperations.cxx
index 9a7ba439c387645d142b02d2581fad04fd0b2d2a..ebba432d7f02b268765aba85ffa8377e20698bdc 100644 (file)
@@ -1,21 +1,23 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #include <Standard_Stream.hxx>
 
@@ -47,6 +49,7 @@
 
 #include <GEOMImpl_Types.hxx>
 
+#include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
 //=============================================================================
@@ -100,6 +103,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
 
   //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;
@@ -152,6 +158,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
 
   //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;
@@ -171,6 +180,114 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
   return aPoint;
 }
 
+//=============================================================================
+/*!
+ *  makePointOnGeom
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
+                    (Handle(GEOM_Object) theGeomObj,
+                     double theParam1,
+                     double theParam2,
+                     double theParam3,
+                     const PointLocation theLocation)
+{
+  SetErrorCode(KO);
+
+  if (theGeomObj.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
+  int fType = POINT_CURVE_PAR;
+  switch( theLocation )
+    {
+    case PointOn_CurveByParam:   fType = POINT_CURVE_PAR; break;
+    case PointOn_CurveByCoord:   fType = POINT_CURVE_COORD; break;
+    case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
+    case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
+    default: break;
+    }
+  Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
+
+  GEOMImpl_IPoint aPI (aFunction);
+
+  Handle(GEOM_Function) aRefFunction = theGeomObj->GetLastFunction();
+  if (aRefFunction.IsNull()) return NULL;
+
+  switch( theLocation )
+    {
+    case PointOn_CurveByParam:
+      aPI.SetCurve(aRefFunction);
+      aPI.SetParameter(theParam1);
+      break;
+    case PointOn_CurveByCoord:
+      aPI.SetCurve(aRefFunction);
+      aPI.SetX(theParam1);
+      aPI.SetY(theParam2);
+      aPI.SetZ(theParam3);
+      break;
+    case PointOn_SurfaceByParam:
+      aPI.SetSurface(aRefFunction);
+      aPI.SetParameter(theParam1);
+      aPI.SetParameter2(theParam2);
+      break;
+    case PointOn_SurfaceByCoord:
+      aPI.SetSurface(aRefFunction);
+      aPI.SetX(theParam1);
+      aPI.SetY(theParam2);
+      aPI.SetZ(theParam3);
+    default: break;
+    }
+  
+  //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
+  switch( theLocation )
+    {
+    case PointOn_CurveByParam:
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
+                                   << theGeomObj << ", " << theParam1 << ")";
+      break;
+    case PointOn_CurveByCoord:
+  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
+                               << theGeomObj << ", " << theParam1 
+                               << ", " << theParam2 << ", " << theParam3 << ")";
+      break;
+    case PointOn_SurfaceByParam:
+  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
+                               << theGeomObj << ", " << theParam1 
+                               << ", " << theParam2 << ")";
+      break;
+    case PointOn_SurfaceByCoord:
+  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
+                               << theGeomObj << ", " << theParam1 
+                               << ", " << theParam2 << ", " << theParam3 << ")";
+    default: break;
+    }
+
+  SetErrorCode(OK);
+  return aPoint;
+}
+
 //=============================================================================
 /*!
  *  MakePointOnCurve
@@ -178,30 +295,87 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
                             (Handle(GEOM_Object) theCurve, double theParameter)
+{
+  return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+}
+
+//=============================================================================
+/*!
+ *  MakePointOnCurveByCoord
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
+                    (Handle(GEOM_Object) theCurve,
+                     double theXParam,
+                     double theYParam,
+                     double theZParam)
+{
+  return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
+}
+
+//=============================================================================
+/*!
+ *  MakePointOnSurface
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface
+                    (Handle(GEOM_Object) theSurface,
+                     double theUParameter,
+                     double theVParameter)
+{
+  return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
+}
+
+//=============================================================================
+/*!
+ *  MakePointOnSurfaceByCoord
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
+                    (Handle(GEOM_Object) theSurface,
+                     double theXParam,
+                     double theYParam,
+                     double theZParam)
+{
+  return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
+}
+
+
+//=============================================================================
+/*!
+ *  MakePointOnLinesIntersection
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
+                            (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2)
 {
   SetErrorCode(KO);
 
-  if (theCurve.IsNull()) return NULL;
+  if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
 
   //Add a new Point object
   Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
 
   //Add a new Point function for creation a point relativley another point
-  Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_CURVE_PAR);
+  Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
 
   //Check if the function is set correctly
   if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
 
   GEOMImpl_IPoint aPI (aFunction);
 
-  Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
-  if (aRefFunction.IsNull()) return NULL;
+  Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction();
+  Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction();
+  if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
 
-  aPI.SetCurve(aRefFunction);
-  aPI.SetParameter(theParameter);
+  aPI.SetLine1(aRef1);
+  aPI.SetLine2(aRef2);
 
   //Compute the point value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Point driver failed");
       return NULL;
@@ -214,13 +388,65 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
   }
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
-                               << theCurve << ", " << theParameter << ")";
+  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection("
+                               << theLine1 << ", " << theLine2 << ")";
 
   SetErrorCode(OK);
   return aPoint;
 }
 
+//=============================================================================
+/*!
+ *  MakeTangentOnCurve
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
+                            (const Handle(GEOM_Object)& theCurve, double theParameter)
+{
+  SetErrorCode(KO);
+
+  if (theCurve.IsNull()) return NULL;
+
+  //Add a new Vector object
+  Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
+
+  //Add a new Point function for creation a point relativley another point
+  Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
+
+  GEOMImpl_IVector aVI (aFunction);
+
+  Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
+  if (aRefFunction.IsNull()) return NULL;
+
+  aVI.SetCurve(aRefFunction);
+  aVI.SetParameter(theParameter);
+
+  //Compute the vector value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Vector 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) << aVec << " = geompy.MakeTangentOnCurve("
+                               << theCurve << ", " << theParameter << ")";
+
+  SetErrorCode(OK);
+  return aVec;
+}
 
 //=============================================================================
 /*!
@@ -251,6 +477,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
 
   //Compute the Vector value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Vector driver failed");
       return NULL;
@@ -303,6 +532,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
 
   //Compute the Vector value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Vector driver failed");
       return NULL;
@@ -356,6 +588,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
 
   //Compute the Line value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Line driver failed");
       return NULL;
@@ -408,6 +643,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
 
   //Compute the Line value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Line driver failed");
       return NULL;
@@ -427,6 +665,60 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
   return aLine;
 }
 
+//=============================================================================
+/*!
+ *  MakeLineTwoFaces
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
+                     (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2)
+{
+  SetErrorCode(KO);
+
+  if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
+
+  //Add a new Line object
+  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
+
+  //Add a new Line function
+  Handle(GEOM_Function) aFunction =
+    aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
+
+  GEOMImpl_ILine aPI (aFunction);
+
+  Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction();
+  Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction();
+  if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
+
+  aPI.SetFace1(aRef1);
+  aPI.SetFace2(aRef2);
+
+  //Compute the Line value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Line driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces("
+                               << theFace1 << ", " << theFace2 << ")";
+
+  SetErrorCode(OK);
+  return aLine;
+}
 
 //=============================================================================
 /*!
@@ -465,6 +757,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
 
   //Compute the Plane value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Plane driver failed");
       return NULL;
@@ -519,6 +814,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
 
   //Compute the Plane value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Plane driver failed");
       return NULL;
@@ -570,6 +868,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
 
   //Compute the Plane value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Plane driver failed");
       return NULL;
@@ -589,6 +890,117 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
   return aPlane;
 }
 
+//=============================================================================
+/*!
+ *  MakePlane2Vec
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
+                       (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2,
+                        double theSize)
+{
+  SetErrorCode(KO);
+
+  if (theVec1.IsNull() || theVec2.IsNull()) return NULL;
+
+  //Add a new Plane object
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+  //Add a new Plane function
+  Handle(GEOM_Function) aFunction =
+    aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_2_VEC);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+  GEOMImpl_IPlane aPI (aFunction);
+
+  Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction();
+  Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction();
+  if (aRefVec1.IsNull() || aRefVec2.IsNull()) return NULL;
+
+  aPI.SetVector1(aRefVec1);
+  aPI.SetVector2(aRefVec2);
+  aPI.SetSize(theSize);
+
+  //Compute the Plane value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Plane 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) << aPlane << " = geompy.MakePlane2Vec("
+    << theVec1 << ", " << theVec2 << ", " << theSize << ")";
+
+  SetErrorCode(OK);
+  return aPlane;
+}
+
+//=============================================================================
+/*!
+ *  MakePlaneLCS
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
+                       (Handle(GEOM_Object) theLCS, double theSize, int theOrientation)
+{
+  SetErrorCode(KO);
+
+  //Add a new Plane object
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+  //Add a new Plane function
+  Handle(GEOM_Function) aFunction =
+    aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_LCS);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+  GEOMImpl_IPlane aPI (aFunction);
+
+  if ( !theLCS.IsNull() ) {
+    Handle(GEOM_Function) aRef = theLCS->GetLastFunction();
+    aPI.SetLCS(aRef);
+  }
+
+  aPI.SetSize(theSize);
+  aPI.SetOrientation(theOrientation);
+
+  //Compute the Plane value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Plane 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) << aPlane << " = geompy.MakePlaneLCS("
+                               << theLCS << ", " << theSize << ", " << theOrientation << ")";
+
+  SetErrorCode(OK);
+  return aPlane;
+}
+
 
 //=============================================================================
 /*!
@@ -621,6 +1033,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
 
   //Compute the marker value
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Marker driver failed");
       return NULL;
@@ -641,3 +1056,64 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
   SetErrorCode(OK);
   return aMarker;
 }
+
+//=============================================================================
+/*!
+ *  MakeTangentPlaneOnFace
+ */
+//=============================================================================
+
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
+                                                                      double theParamU,
+                                                                      double theParamV,
+                                                                      double theSize)
+{
+   SetErrorCode(KO);
+
+  if (theFace.IsNull()) return NULL;
+
+  //Add a new Plane object
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+  //Add a new Plane function
+  Handle(GEOM_Function) aFunction =
+    aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+  GEOMImpl_IPlane aPI (aFunction);
+
+  Handle(GEOM_Function) aRef = theFace->GetLastFunction();
+  if (aRef.IsNull()) return NULL;
+
+  aPI.SetFace(aRef);
+  aPI.SetSize(theSize);
+  aPI.SetParameterU(theParamU);
+  aPI.SetParameterV(theParamV);
+
+  //Compute the Plane value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Plane 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) << aPlane << " = geompy.MakeTangentPlaneOnFace("
+                               << theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";
+
+  SetErrorCode(OK);
+  return aPlane;
+}
+
+