Salome HOME
29470 - Point cloud on a face
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBasicOperations.cxx
index cb81f958f70ce6cc3eb20189729b77e72f043b7d..659d8ff6484799c5f8f8678f251adb8e958c1374 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 
 #include <GEOMImpl_IBasicOperations.hxx>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include "utilities.h"
-#include <OpUtil.hxx>
 #include <Utils_ExceptHandlers.hxx>
 
 #include <TFunction_DriverTable.hxx>
 #include <TFunction_Driver.hxx>
-#include <TFunction_Logbook.hxx>
 #include <TDF_Tool.hxx>
 
 #include <GEOM_Function.hxx>
@@ -60,8 +56,8 @@
  *   constructor:
  */
 //=============================================================================
-GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
 {
   MESSAGE("GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations");
 }
@@ -88,7 +84,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
   SetErrorCode(KO);
 
   //Add a new Point object
-  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT);
 
   //Add a new Point function with XYZ parameters
   Handle(GEOM_Function) aFunction =
@@ -112,9 +108,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -139,7 +134,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
   if (theReference.IsNull()) return NULL;
 
   //Add a new Point object
-  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT);
 
   //Add a new Point function for creation a point relativley another point
   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ_REF);
@@ -165,9 +160,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -186,10 +180,12 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
                     (Handle(GEOM_Object) theGeomObj,
-                     double theParam1,
-                     double theParam2,
-                     double theParam3,
+                     double              theParam1,
+                     double              theParam2,
+                     double              theParam3,
                      const PointLocation theLocation,
+                     int                 theNumberOfPnts,
+                     const bool          takeOrientationIntoAccount,
                      Handle(GEOM_Object) theRefPoint)
 {
   SetErrorCode(KO);
@@ -197,7 +193,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
   if (theGeomObj.IsNull()) return NULL;
 
   //Add a new Point object
-  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT);
 
   //Add a new Point function for creation a point relativley another point
   int fType = POINT_CURVE_PAR;
@@ -226,6 +222,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
     case PointOn_CurveByParam:
       aPI.SetCurve(aRefFunction);
       aPI.SetParameter(theParam1);
+      aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount);
       break;
     case PointOn_CurveByLength:
       aPI.SetCurve(aRefFunction);
@@ -254,6 +251,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       break;
     case PointOn_Face:
       aPI.SetSurface(aRefFunction);
+      aPI.SetNumberOfPoints(theNumberOfPnts);
       break;
     default: break;
     }
@@ -266,9 +264,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -277,7 +274,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
     {
     case PointOn_CurveByParam:
       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
-                                   << theGeomObj << ", " << theParam1 << ")";
+                                   << theGeomObj << ", " << theParam1 << ", "
+                                   << takeOrientationIntoAccount <<  ")";
       break;
     case PointOn_CurveByLength:
       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
@@ -300,7 +298,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       break;
     case PointOn_Face:
       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexInsideFace("
-                                   << theGeomObj << ")";
+                                   << theGeomObj << ", " << theNumberOfPnts << ")";
       break;
     default: break;
     }
@@ -315,9 +313,12 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
-                            (Handle(GEOM_Object) theCurve, double theParameter)
+                            (Handle(GEOM_Object) theCurve,
+                             double              theParameter,
+                             bool                takeOrientationIntoAccount)
 {
-  return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+  return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam,
+                         1, takeOrientationIntoAccount);
 }
 
 //=============================================================================
@@ -344,7 +345,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
                      double              theLength, 
                      Handle(GEOM_Object) theStartPoint)
 {
-  return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint);
+  return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength,
+                         1, false, theStartPoint);
 }
 
 //=============================================================================
@@ -379,9 +381,10 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
  *  MakePointOnFace
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnFace (Handle(GEOM_Object) theFace)
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnFace (Handle(GEOM_Object) theFace,
+                                                                int                 theNumberOfPnts)
 {
-  return makePointOnGeom(theFace, 0., 0., 0., PointOn_Face);
+  return makePointOnGeom(theFace, 0., 0., 0., PointOn_Face, theNumberOfPnts);
 }
 
 //=============================================================================
@@ -397,7 +400,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
   if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
 
   //Add a new Point object
-  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+  Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT);
 
   //Add a new Point function for creation a point relativley another point
   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
@@ -422,9 +425,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -449,7 +451,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
   if (theCurve.IsNull()) return NULL;
 
   //Add a new Vector object
-  Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
+  Handle(GEOM_Object) aVec = GetEngine()->AddObject(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);
@@ -473,9 +475,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -498,7 +499,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
   SetErrorCode(KO);
 
   //Add a new Vector object
-  Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
+  Handle(GEOM_Object) aVector = GetEngine()->AddObject(GEOM_VECTOR);
 
   //Add a new Vector function with DXDYDZ parameters
   Handle(GEOM_Function) aFunction =
@@ -522,9 +523,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -549,7 +549,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
 
   //Add a new Vector object
-  Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
+  Handle(GEOM_Object) aVector = GetEngine()->AddObject(GEOM_VECTOR);
 
   //Add a new Vector function
   Handle(GEOM_Function) aFunction =
@@ -575,9 +575,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -603,7 +602,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
   if (thePnt.IsNull() || theDir.IsNull()) return NULL;
 
   //Add a new Line object
-  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
+  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE);
 
   //Add a new Line function
   Handle(GEOM_Function) aFunction =
@@ -629,9 +628,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -656,7 +654,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
 
   //Add a new Line object
-  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
+  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE);
 
   //Add a new Line function
   Handle(GEOM_Function) aFunction =
@@ -682,9 +680,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -709,7 +706,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
   if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
 
   //Add a new Line object
-  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
+  Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE);
 
   //Add a new Line function
   Handle(GEOM_Function) aFunction =
@@ -735,9 +732,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -763,7 +759,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
   if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -792,9 +788,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -820,7 +815,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -847,9 +842,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -874,7 +868,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
   if (theFace.IsNull()) return NULL;
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -899,9 +893,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -927,7 +920,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
   if (theVec1.IsNull() || theVec2.IsNull()) return NULL;
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -954,9 +947,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -979,7 +971,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
   SetErrorCode(KO);
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -1006,9 +998,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1034,7 +1025,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
   SetErrorCode(KO);
 
   //Add a new Marker object
-  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
+  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER);
 
   //Add a new Marker function
   Handle(GEOM_Function) aFunction =
@@ -1058,9 +1049,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1085,7 +1075,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape
   SetErrorCode(KO);
 
   //Add a new Marker object
-  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
+  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER);
 
   //Add a new Marker function
   Handle(GEOM_Function) aFunction =
@@ -1110,9 +1100,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1136,7 +1125,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec
   SetErrorCode(KO);
 
   //Add a new Marker object
-  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER);
+  Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER);
 
   //Add a new Marker function
   Handle(GEOM_Function) aFunction =
@@ -1165,9 +1154,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1195,7 +1183,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand
   if (theFace.IsNull()) return NULL;
 
   //Add a new Plane object
-  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE);
 
   //Add a new Plane function
   Handle(GEOM_Function) aFunction =
@@ -1222,9 +1210,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }