Salome HOME
Remove unnecessary includes
[modules/geom.git] / src / GEOMImpl / GEOMImpl_I3DPrimOperations.cxx
index 9d7bfa787cc645661c95903a94edae06edd49c30..d9f441df9c69935f268aafa473ad9167152583b3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  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 <Standard_Stream.hxx>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <GEOMImpl_I3DPrimOperations.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>
@@ -77,7 +73,6 @@
 
 #include <Precision.hxx>
 #include <TopExp.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
 
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
  *   constructor:
  */
 //=============================================================================
-GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
 {
   MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations");
-  myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
+  myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine());
 }
 
 //=============================================================================
@@ -116,7 +111,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, dou
   SetErrorCode(KO);
 
   //Add a new Box object
-  Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
+  Handle(GEOM_Object) aBox = GetEngine()->AddObject(GEOM_BOX);
 
   //Add a new Box function with DX_DY_DZ parameters
   Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_DX_DY_DZ);
@@ -139,9 +134,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, dou
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -167,7 +161,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec
   if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL;
 
   //Add a new Box object
-  Handle(GEOM_Object) aBox = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
+  Handle(GEOM_Object) aBox = GetEngine()->AddObject(GEOM_BOX);
 
   //Add a new Box function for creation a box relatively to two points
   Handle(GEOM_Function) aFunction = aBox->AddFunction(GEOMImpl_BoxDriver::GetID(), BOX_TWO_PNT);
@@ -194,9 +188,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -220,7 +213,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double
   if (theH == 0 || theW == 0) return NULL;
 
   //Add a new Face object
-  Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+  Handle(GEOM_Object) aFace = GetEngine()->AddObject(GEOM_FACE);
 
   //Add a new Box function for creation a box relatively to two points
   Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_H_W);
@@ -243,9 +236,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -270,7 +262,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Objec
   if (theObj.IsNull()) return NULL;
 
   //Add a new Face object
-  Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+  Handle(GEOM_Object) aFace = GetEngine()->AddObject(GEOM_FACE);
 
   //Add a new Box function for creation a box relatively to two points
   Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_OBJ_H_W);
@@ -298,9 +290,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Objec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -325,7 +316,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Disk object
-  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GEOM_FACE);
 
   //Add a new Disk function for creation a disk relatively to point and vector
   Handle(GEOM_Function) aFunction =
@@ -354,9 +345,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -382,7 +372,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Ob
   if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
 
   //Add a new Disk object
-  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GEOM_FACE);
 
   //Add a new Disk function for creation a disk relatively to three points
   Handle(GEOM_Function) aFunction =
@@ -412,9 +402,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Ob
       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 +427,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theO
   if (theR == 0 ) return NULL;
 
   //Add a new Disk object
-  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
+  Handle(GEOM_Object) aDisk = GetEngine()->AddObject(GEOM_FACE);
 
   //Add a new Box function for creation a box relatively to two points
   Handle(GEOM_Function) aFunction = aDisk->AddFunction(GEOMImpl_DiskDriver::GetID(), DISK_R);
@@ -460,9 +449,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theO
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -484,7 +472,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
   SetErrorCode(KO);
 
   //Add a new Cylinder object
-  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GEOM_CYLINDER);
 
   //Add a new Cylinder function with R and H parameters
   Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H);
@@ -506,9 +494,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -530,7 +517,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRHA (double theR, do
   SetErrorCode(KO);
 
   //Add a new Cylinder object
-  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GEOM_CYLINDER);
 
   //Add a new Cylinder function with R and H parameters
   Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H_A);
@@ -553,9 +540,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRHA (double theR, do
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -581,7 +567,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Cylinder object
-  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GEOM_CYLINDER);
 
   //Add a new Cylinder function for creation a cylinder relatively to point and vector
   Handle(GEOM_Function) aFunction =
@@ -611,9 +597,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -639,7 +624,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GE
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Cylinder object
-  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+  Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GEOM_CYLINDER);
 
   //Add a new Cylinder function for creation a cylinder relatively to point and vector
   Handle(GEOM_Function) aFunction =
@@ -670,9 +655,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GE
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -696,7 +680,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, dou
   SetErrorCode(KO);
 
   //Add a new Cone object
-  Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
+  Handle(GEOM_Object) aCone = GetEngine()->AddObject(GEOM_CONE);
 
   //Add a new Cone function with R and H parameters
   Handle(GEOM_Function) aFunction =
@@ -720,9 +704,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, dou
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -750,7 +733,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Cone object
-  Handle(GEOM_Object) aCone = GetEngine()->AddObject(GetDocID(), GEOM_CONE);
+  Handle(GEOM_Object) aCone = GetEngine()->AddObject(GEOM_CONE);
 
   //Add a new Cone function for creation a cone relatively to point and vector
   Handle(GEOM_Function) aFunction =
@@ -781,9 +764,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -806,7 +788,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR)
   SetErrorCode(KO);
 
   //Add a new Sphere object
-  Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
+  Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GEOM_SPHERE);
 
   //Add a new Sphere function with R parameter
   Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_R);
@@ -827,9 +809,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -854,7 +835,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Obje
   if (thePnt.IsNull()) return NULL;
 
   //Add a new Point object
-  Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GetDocID(), GEOM_SPHERE);
+  Handle(GEOM_Object) aSphere = GetEngine()->AddObject(GEOM_SPHERE);
 
   //Add a new Sphere function for creation a sphere relatively to point
   Handle(GEOM_Function) aFunction = aSphere->AddFunction(GEOMImpl_SphereDriver::GetID(), SPHERE_PNT_R);
@@ -880,9 +861,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Obje
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -906,7 +886,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR
   SetErrorCode(KO);
 
   //Add a new Torus object
-  Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
+  Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_TORUS);
 
   //Add a new Torus function
   Handle(GEOM_Function) aFunction =
@@ -929,9 +909,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -957,7 +936,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR
   if (thePnt.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Torus object
-  Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_TORUS);
+  Handle(GEOM_Object) anEll = GetEngine()->AddObject(GEOM_TORUS);
 
   //Add a new Torus function
   Handle(GEOM_Function) aFunction =
@@ -987,9 +966,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1016,7 +994,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec
   if (theBase.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism relatively to vector
   Handle(GEOM_Function) aFunction =
@@ -1047,9 +1025,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1079,7 +1056,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_
   if (theBase.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism relatively to vector
   Handle(GEOM_Function) aFunction =
@@ -1109,9 +1086,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1138,7 +1114,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt
   if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism relatively to two points
   Handle(GEOM_Function) aFunction =
@@ -1170,9 +1146,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1202,7 +1177,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways
   if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism relatively to two points
   Handle(GEOM_Function) aFunction =
@@ -1233,9 +1208,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1261,7 +1235,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ
   if (theBase.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism by DXDYDZ
   Handle(GEOM_Function) aFunction =
@@ -1291,9 +1265,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1323,7 +1296,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways
   if (theBase.IsNull()) return NULL;
 
   //Add a new Prism object
-  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+  Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GEOM_PRISM);
 
   //Add a new Prism function for creation a Prism by DXDYDZ
   Handle(GEOM_Function) aFunction =
@@ -1352,9 +1325,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1383,12 +1355,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
   if ( theFuse )
   {
     //Add a new Extruded Boss object  
-    aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_BOSS);
+    aPrism = GetEngine()->AddObject(GEOM_EXTRUDED_BOSS);
   }
   else
   { 
     //Add a new Extruded Cut object  
-    aPrism = GetEngine()->AddObject(GetDocID(), GEOM_EXTRUDED_CUT);
+    aPrism = GetEngine()->AddObject(GEOM_EXTRUDED_CUT);
   }
   
   //Add a new Prism function for the creation of a Draft Prism feature
@@ -1425,9 +1397,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
   
@@ -1466,7 +1437,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_I3DPrimOperations::MakePipe
   if (theBase.IsNull() || thePath.IsNull()) return NULL;
 
   //Add a new Pipe object
-  Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+  Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GEOM_PIPE);
 
   //Add a new Pipe function
   Handle(GEOM_Function) aFunction =
@@ -1495,9 +1466,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_I3DPrimOperations::MakePipe
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1543,7 +1513,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(
   if (theBase.IsNull() || theAxis.IsNull()) return NULL;
 
   //Add a new Revolution object
-  Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
+  Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GEOM_REVOLUTION);
 
   //Add a new Revolution function for creation a revolution relatively to axis
   Handle(GEOM_Function) aFunction =
@@ -1572,9 +1542,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1599,7 +1568,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
   if (theBase.IsNull() || theAxis.IsNull()) return NULL;
 
   //Add a new Revolution object
-  Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
+  Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GEOM_REVOLUTION);
 
   //Add a new Revolution function for creation a revolution relatively to axis
   Handle(GEOM_Function) aFunction =
@@ -1628,9 +1597,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1661,7 +1629,7 @@ GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theCo
     return NULL;
   }
   //Add a new Filling object
-  Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
+  Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GEOM_FILLING);
 
   //Add a new Filling function for creation a filling  from a compound
   Handle(GEOM_Function) aFunction = aFilling->AddFunction(GEOMImpl_FillingDriver::GetID(), BASIC_FILLING);
@@ -1688,12 +1656,11 @@ GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theCo
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    if (strcmp(aFail->GetMessageString(), "Geom_BSplineSurface") == 0)
+  catch (Standard_Failure& aFail) {
+    if (strcmp(aFail.GetMessageString(), "Geom_BSplineSurface") == 0)
       SetErrorCode("B-Spline surface construction failed");
     else
-      SetErrorCode(aFail->GetMessageString());
+      SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -1737,7 +1704,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
     return anObj;
 
   //Add a new ThruSections object
-  Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GetDocID(), GEOM_THRUSECTIONS);
+  Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GEOM_THRUSECTIONS);
 
 
   //Add a new ThruSections function
@@ -1785,9 +1752,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections(
       return anObj;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return anObj;
   }
 
@@ -1842,7 +1808,7 @@ Handle(TColStd_HSequenceOfTransient)
 
   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
   //Add a new Pipe object
-  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GEOM_PIPE);
 
   //Add a new Pipe function
 
@@ -1911,13 +1877,12 @@ Handle(TColStd_HSequenceOfTransient)
   try {
     OCC_CATCH_SIGNALS;
     if (!GetSolver()->ComputeFunction(aFunction)) {
-      SetErrorCode("Pipe with defferent section driver failed");
+      SetErrorCode("Pipe with different section 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;
   }
 
@@ -2018,7 +1983,7 @@ Handle(TColStd_HSequenceOfTransient)
   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
 
   //Add a new Pipe object
-  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GEOM_PIPE);
 
   //Add a new Pipe function
 
@@ -2101,9 +2066,8 @@ Handle(TColStd_HSequenceOfTransient)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2207,7 +2171,7 @@ Handle(TColStd_HSequenceOfTransient)
   Standard_Integer nbLocs =  (theLocations.IsNull() ? 0 :theLocations->Length());
 
   //Add a new Pipe object
-  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+  Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GEOM_PIPE);
 
   //Add a new Pipe function
 
@@ -2267,9 +2231,8 @@ Handle(TColStd_HSequenceOfTransient)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2350,7 +2313,7 @@ Handle(TColStd_HSequenceOfTransient)
   if (theBase.IsNull() || thePath.IsNull() || theVec.IsNull()) return NULL;
 
   //Add a new Pipe object
-  Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+  Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GEOM_PIPE);
 
   //Add a new Pipe function
   Handle(GEOM_Function) aFunction =
@@ -2381,9 +2344,8 @@ Handle(TColStd_HSequenceOfTransient)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2440,7 +2402,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
   if (isCopy)
   { 
     //Add a new Copy object
-    aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+    aCopy = GetEngine()->AddObject(theObject->GetType());
     aFunction = aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING_COPY);
   }
   else
@@ -2468,9 +2430,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+  catch (Standard_Failure& aFail) {
+    SetErrorCode(aFail.GetMessageString());
     return NULL;
   }
 
@@ -2523,7 +2484,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath (Handle(GEOM_Object)
   if (theShape.IsNull() || theBase1.IsNull() || theBase2.IsNull()) return NULL;
 
   // Add a new Path object
-  Handle(GEOM_Object) aPath = GetEngine()->AddObject(GetDocID(), GEOM_PIPE_PATH);
+  Handle(GEOM_Object) aPath = GetEngine()->AddObject(GEOM_PIPE_PATH);
 
   // Add a new Path function
   Handle(GEOM_Function) aFunction =
@@ -2553,8 +2514,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath (Handle(GEOM_Object)
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+  catch (Standard_Failure& aFail) {
     SetErrorCode("RestorePath: inappropriate arguments given");
     return NULL;
   }
@@ -2588,7 +2548,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath
     return NULL;
 
   // Add a new Path object
-  Handle(GEOM_Object) aPath = GetEngine()->AddObject(GetDocID(), GEOM_PIPE_PATH);
+  Handle(GEOM_Object) aPath = GetEngine()->AddObject(GEOM_PIPE_PATH);
 
   // Add a new Path function
   Handle(GEOM_Function) aFunction =
@@ -2643,8 +2603,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath
       return NULL;
     }
   }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+  catch (Standard_Failure& aFail) {
     SetErrorCode("RestorePath: inappropriate arguments given");
     return NULL;
   }