Salome HOME
29470 - Point cloud on a face
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBasicOperations.cxx
index e29905bd358e9baf5628c271f3781eda35c999ed..659d8ff6484799c5f8f8678f251adb8e958c1374 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  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
@@ -6,7 +6,7 @@
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #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 =
@@ -106,17 +102,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ
 
   //Compute the point value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -141,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);
@@ -161,17 +154,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
 
   //Compute the point value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -190,28 +180,31 @@ 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,
-                    Handle(GEOM_Object) theRefPoint)
+                     int                 theNumberOfPnts,
+                     const bool          takeOrientationIntoAccount,
+                     Handle(GEOM_Object) theRefPoint)
 {
   SetErrorCode(KO);
 
   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;
   switch( theLocation )
     {
     case PointOn_CurveByParam:   fType = POINT_CURVE_PAR; break;
-    case PointOn_CurveByLength:  fType = POINT_CURVE_LENGTH; break;                             
+    case PointOn_CurveByLength:  fType = POINT_CURVE_LENGTH; 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;
+    case PointOn_Face:           fType = POINT_FACE_ANY; break;
     default: break;
     }
   Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
@@ -229,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,22 +248,24 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       aPI.SetX(theParam1);
       aPI.SetY(theParam2);
       aPI.SetZ(theParam3);
+      break;
+    case PointOn_Face:
+      aPI.SetSurface(aRefFunction);
+      aPI.SetNumberOfPoints(theNumberOfPnts);
+      break;
     default: break;
     }
   
   //Compute the point value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -278,26 +274,32 @@ 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("
                                    << theGeomObj << ", " << theParam1 << ", " << theRefPoint <<  ")";
       break;
     case PointOn_CurveByCoord:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ", " << theParam3 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ", " << theParam3 << ")";
       break;
     case PointOn_SurfaceByParam:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ")";
       break;
     case PointOn_SurfaceByCoord:
-  GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
-                               << theGeomObj << ", " << theParam1 
-                               << ", " << theParam2 << ", " << theParam3 << ")";
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
+                                   << theGeomObj << ", " << theParam1 
+                                   << ", " << theParam2 << ", " << theParam3 << ")";
+      break;
+    case PointOn_Face:
+      GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexInsideFace("
+                                   << theGeomObj << ", " << theNumberOfPnts << ")";
+      break;
     default: break;
     }
 
@@ -311,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);
 }
 
 //=============================================================================
@@ -337,10 +342,11 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
                     (Handle(GEOM_Object) theCurve, 
-                    double              theLength, 
-                    Handle(GEOM_Object) theStartPoint)
+                     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);
 }
 
 //=============================================================================
@@ -370,6 +376,16 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
   return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
 }
 
+//=============================================================================
+/*!
+ *  MakePointOnFace
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnFace (Handle(GEOM_Object) theFace,
+                                                                int                 theNumberOfPnts)
+{
+  return makePointOnGeom(theFace, 0., 0., 0., PointOn_Face, theNumberOfPnts);
+}
 
 //=============================================================================
 /*!
@@ -384,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);
@@ -403,17 +419,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
 
   //Compute the point value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -438,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);
@@ -456,17 +469,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
 
   //Compute the vector value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -489,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 =
@@ -507,17 +517,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ
 
   //Compute the Vector value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -542,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 =
@@ -562,17 +569,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt
 
   //Compute the Vector value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -598,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 =
@@ -618,17 +622,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine
 
   //Compute the Line value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -653,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 =
@@ -673,17 +674,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt
 
   //Compute the Line value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -708,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 =
@@ -728,17 +726,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
 
   //Compute the Line value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -764,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 =
@@ -787,17 +782,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -823,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 =
@@ -844,17 +836,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -879,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 =
@@ -898,17 +887,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -934,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 =
@@ -955,17 +941,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -988,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 =
@@ -1009,17 +992,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1045,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 =
@@ -1063,17 +1043,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
 
   //Compute the marker value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Marker driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1098,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 =
@@ -1117,17 +1094,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape
 
   //Compute the marker value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Marker driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1151,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 =
@@ -1174,17 +1148,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec
 
   //Compute the marker value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Marker driver failed");
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1212,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 =
@@ -1233,17 +1204,14 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand
 
   //Compute the Plane value
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     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());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }