Salome HOME
Remove unnecessary includes
[modules/geom.git] / src / GEOMImpl / GEOMImpl_I3DPrimOperations.cxx
index ba87e9c4f2c3842a237c965a7ef18a3ff0dd75c1..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>
  *   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());
 }
 
 //=============================================================================
@@ -114,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);
@@ -137,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;
   }
 
@@ -165,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);
@@ -192,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;
   }
 
@@ -218,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);
@@ -241,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;
   }
 
@@ -268,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);
@@ -296,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;
   }
 
@@ -323,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 =
@@ -352,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;
   }
 
@@ -380,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 =
@@ -410,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;
   }
 
@@ -436,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);
@@ -458,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;
   }
 
@@ -482,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);
@@ -504,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;
   }
 
@@ -528,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);
@@ -551,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;
   }
 
@@ -579,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 =
@@ -609,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;
   }
 
@@ -637,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 =
@@ -668,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;
   }
 
@@ -694,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 =
@@ -718,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;
   }
 
@@ -748,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 =
@@ -779,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;
   }
 
@@ -804,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);
@@ -825,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;
   }
 
@@ -852,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);
@@ -878,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;
   }
 
@@ -904,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 =
@@ -927,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;
   }
 
@@ -955,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 =
@@ -985,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;
   }
 
@@ -1014,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 =
@@ -1045,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;
   }
 
@@ -1077,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 =
@@ -1107,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;
   }
 
@@ -1136,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 =
@@ -1168,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;
   }
 
@@ -1200,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 =
@@ -1231,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;
   }
 
@@ -1259,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 =
@@ -1289,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;
   }
 
@@ -1321,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 =
@@ -1350,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;
   }
 
@@ -1381,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
@@ -1423,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;
   }
   
@@ -1464,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 =
@@ -1493,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;
   }
 
@@ -1541,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 =
@@ -1570,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;
   }
 
@@ -1597,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 =
@@ -1626,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;
   }
 
@@ -1659,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);
@@ -1686,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;
   }
 
@@ -1735,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
@@ -1783,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;
   }
 
@@ -1840,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
 
@@ -1909,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;
   }
 
@@ -2016,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
 
@@ -2099,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;
   }
 
@@ -2205,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
 
@@ -2265,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;
   }
 
@@ -2348,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 =
@@ -2379,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;
   }
 
@@ -2438,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
@@ -2466,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;
   }
 
@@ -2521,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 =
@@ -2551,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;
   }
@@ -2586,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 =
@@ -2641,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;
   }