Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry
[modules/geom.git] / src / GEOM_I / GEOM_IBlocksOperations_i.cc
index 4c1d25cdd40824d2d0275cea0432319ed40f2967..e24fe856b8fa2b97dc5d7a2342c1adfb935de4a0 100644 (file)
@@ -1,4 +1,26 @@
-using namespace std;
+// Copyright (C) 2007-2016  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
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <Standard_Stream.hxx>
 
 #include "GEOM_IBlocksOperations_i.hh"
 
@@ -18,8 +40,8 @@ using namespace std;
  */
 //=============================================================================
 GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i (PortableServer::POA_ptr thePOA,
-                                                   GEOM::GEOM_Gen_ptr theEngine,
-                                                   ::GEOMImpl_IBlocksOperations* theImpl)
+                                                    GEOM::GEOM_Gen_ptr theEngine,
+                                                    ::GEOMImpl_IBlocksOperations* theImpl)
 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_IBlocksOperations_i::GEOM_IBlocksOperations_i");
@@ -43,31 +65,24 @@ GEOM_IBlocksOperations_i::~GEOM_IBlocksOperations_i()
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad
                (GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
-               GEOM::GEOM_Object_ptr theEdge3, GEOM::GEOM_Object_ptr theEdge4)
+                GEOM::GEOM_Object_ptr theEdge3, GEOM::GEOM_Object_ptr theEdge4)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theEdge1 == NULL || theEdge2 == NULL ||
-      theEdge3 == NULL || theEdge4 == NULL) return aGEOMObject._retn();
-
   //Get the reference edges
-  Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject
-    (theEdge1->GetStudyID(), theEdge1->GetEntry());
-  Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject
-    (theEdge2->GetStudyID(), theEdge2->GetEntry());
-  Handle(GEOM_Object) anEdge3 = GetOperations()->GetEngine()->GetObject
-    (theEdge3->GetStudyID(), theEdge3->GetEntry());
-  Handle(GEOM_Object) anEdge4 = GetOperations()->GetEngine()->GetObject
-    (theEdge4->GetStudyID(), theEdge4->GetEntry());
+  Handle(::GEOM_Object) anEdge1 = GetObjectImpl(theEdge1);
+  Handle(::GEOM_Object) anEdge2 = GetObjectImpl(theEdge2);
+  Handle(::GEOM_Object) anEdge3 = GetObjectImpl(theEdge3);
+  Handle(::GEOM_Object) anEdge4 = GetObjectImpl(theEdge4);
 
   if (anEdge1.IsNull() || anEdge2.IsNull() ||
       anEdge3.IsNull() || anEdge4.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakeQuad(anEdge1, anEdge2, anEdge3, anEdge4);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -88,18 +103,14 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad2Edges
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn();
-
   //Get the reference edges
-  Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject
-    (theEdge1->GetStudyID(), theEdge1->GetEntry());
-  Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject
-    (theEdge2->GetStudyID(), theEdge2->GetEntry());
+  Handle(::GEOM_Object) anEdge1 = GetObjectImpl(theEdge1);
+  Handle(::GEOM_Object) anEdge2 = GetObjectImpl(theEdge2);
 
   if (anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakeQuad2Edges(anEdge1, anEdge2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -114,31 +125,24 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad2Edges
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad4Vertices
                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
-                      GEOM::GEOM_Object_ptr thePnt3, GEOM::GEOM_Object_ptr thePnt4)
+                       GEOM::GEOM_Object_ptr thePnt3, GEOM::GEOM_Object_ptr thePnt4)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL ||
-      thePnt3 == NULL || thePnt4 == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
-  Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
-    (thePnt3->GetStudyID(), thePnt3->GetEntry());
-  Handle(GEOM_Object) aPnt4 = GetOperations()->GetEngine()->GetObject
-    (thePnt4->GetStudyID(), thePnt4->GetEntry());
+  Handle(::GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
+  Handle(::GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
+  Handle(::GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
+  Handle(::GEOM_Object) aPnt4 = GetObjectImpl(thePnt4);
 
   if (aPnt1.IsNull() || aPnt2.IsNull() ||
       aPnt3.IsNull() || aPnt4.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakeQuad4Vertices(aPnt1, aPnt2, aPnt3, aPnt4);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -153,38 +157,28 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeQuad4Vertices
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa
                (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
-               GEOM::GEOM_Object_ptr theFace3, GEOM::GEOM_Object_ptr theFace4,
-               GEOM::GEOM_Object_ptr theFace5, GEOM::GEOM_Object_ptr theFace6)
+                GEOM::GEOM_Object_ptr theFace3, GEOM::GEOM_Object_ptr theFace4,
+                GEOM::GEOM_Object_ptr theFace5, GEOM::GEOM_Object_ptr theFace6)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theFace1 == NULL || theFace2 == NULL ||
-      theFace3 == NULL || theFace4 == NULL ||
-      theFace5 == NULL || theFace6 == NULL) return aGEOMObject._retn();
-
   //Get the reference Faces
-  Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject
-    (theFace1->GetStudyID(), theFace1->GetEntry());
-  Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject
-    (theFace2->GetStudyID(), theFace2->GetEntry());
-  Handle(GEOM_Object) anFace3 = GetOperations()->GetEngine()->GetObject
-    (theFace3->GetStudyID(), theFace3->GetEntry());
-  Handle(GEOM_Object) anFace4 = GetOperations()->GetEngine()->GetObject
-    (theFace4->GetStudyID(), theFace4->GetEntry());
-  Handle(GEOM_Object) anFace5 = GetOperations()->GetEngine()->GetObject
-    (theFace5->GetStudyID(), theFace5->GetEntry());
-  Handle(GEOM_Object) anFace6 = GetOperations()->GetEngine()->GetObject
-    (theFace6->GetStudyID(), theFace6->GetEntry());
+  Handle(::GEOM_Object) anFace1 = GetObjectImpl(theFace1);
+  Handle(::GEOM_Object) anFace2 = GetObjectImpl(theFace2);
+  Handle(::GEOM_Object) anFace3 = GetObjectImpl(theFace3);
+  Handle(::GEOM_Object) anFace4 = GetObjectImpl(theFace4);
+  Handle(::GEOM_Object) anFace5 = GetObjectImpl(theFace5);
+  Handle(::GEOM_Object) anFace6 = GetObjectImpl(theFace6);
 
   if (anFace1.IsNull() || anFace2.IsNull() ||
       anFace3.IsNull() || anFace4.IsNull() ||
       anFace5.IsNull() || anFace6.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject = GetOperations()->MakeHexa
+  Handle(::GEOM_Object) anObject = GetOperations()->MakeHexa
     (anFace1, anFace2, anFace3, anFace4, anFace5, anFace6);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -205,18 +199,14 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeHexa2Faces
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn();
-
   //Get the reference Faces
-  Handle(GEOM_Object) anFace1 = GetOperations()->GetEngine()->GetObject
-    (theFace1->GetStudyID(), theFace1->GetEntry());
-  Handle(GEOM_Object) anFace2 = GetOperations()->GetEngine()->GetObject
-    (theFace2->GetStudyID(), theFace2->GetEntry());
+  Handle(::GEOM_Object) anFace1 = GetObjectImpl(theFace1);
+  Handle(::GEOM_Object) anFace2 = GetObjectImpl(theFace2);
 
   if (anFace1.IsNull() || anFace2.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakeHexa2Faces(anFace1, anFace2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -237,16 +227,12 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeBlockCompound
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return aGEOMObject._retn();
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return aGEOMObject._retn();
 
   //Create the Blocks Compound
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->MakeBlockCompound(aCompound);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -260,26 +246,22 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeBlockCompound
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr theShape,
-                                                         const CORBA::Double   theX,
-                                                         const CORBA::Double   theY,
-                                                         const CORBA::Double   theZ,
-                                                         const CORBA::Double   theEpsilon)
+                                                          const CORBA::Double   theX,
+                                                          const CORBA::Double   theY,
+                                                          const CORBA::Double   theZ,
+                                                          const CORBA::Double   theEpsilon)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return aGEOMObject._retn();
 
   //Create the Point
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetPoint(aShape, theX, theY, theZ, theEpsilon);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -287,36 +269,58 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetVertexNearPoint
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetVertexNearPoint
+                                                (GEOM::GEOM_Object_ptr theShape,
+                                                 GEOM::GEOM_Object_ptr thePoint)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Get the reference Objects
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
+  if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
+
+  // Create the Point
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->GetVertexNearPoint(aShape, aPoint);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  GetEdge
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdge (GEOM::GEOM_Object_ptr theShape,
-                                                        GEOM::GEOM_Object_ptr thePoint1,
-                                                        GEOM::GEOM_Object_ptr thePoint2)
+                                                         GEOM::GEOM_Object_ptr thePoint1,
+                                                         GEOM::GEOM_Object_ptr thePoint2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      thePoint1 == NULL || thePoint2 == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
-    (thePoint1->GetStudyID(), thePoint1->GetEntry());
-  Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
-    (thePoint2->GetStudyID(), thePoint2->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
+  Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
 
   if (aShape.IsNull() ||
       aPoint1.IsNull() || aPoint2.IsNull()) return aGEOMObject._retn();
 
   //Create the Point
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetEdge(aShape, aPoint1, aPoint2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -330,25 +334,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdge (GEOM::GEOM_Object_ptr t
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdgeNearPoint (GEOM::GEOM_Object_ptr theShape,
-                                                                 GEOM::GEOM_Object_ptr thePoint)
+                                                                  GEOM::GEOM_Object_ptr thePoint)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
 
   if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
 
   //Create the Edge
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetEdgeNearPoint(aShape, aPoint);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -363,38 +363,29 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetEdgeNearPoint (GEOM::GEOM_Obj
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByPoints
                                               (GEOM::GEOM_Object_ptr theShape,
-                                              GEOM::GEOM_Object_ptr thePoint1,
-                                              GEOM::GEOM_Object_ptr thePoint2,
-                                              GEOM::GEOM_Object_ptr thePoint3,
-                                              GEOM::GEOM_Object_ptr thePoint4)
+                                               GEOM::GEOM_Object_ptr thePoint1,
+                                               GEOM::GEOM_Object_ptr thePoint2,
+                                               GEOM::GEOM_Object_ptr thePoint3,
+                                               GEOM::GEOM_Object_ptr thePoint4)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      thePoint1 == NULL || thePoint2 == NULL ||
-      thePoint3 == NULL || thePoint4 == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
-    (thePoint1->GetStudyID(), thePoint1->GetEntry());
-  Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
-    (thePoint2->GetStudyID(), thePoint2->GetEntry());
-  Handle(GEOM_Object) aPoint3 = GetOperations()->GetEngine()->GetObject
-    (thePoint3->GetStudyID(), thePoint3->GetEntry());
-  Handle(GEOM_Object) aPoint4 = GetOperations()->GetEngine()->GetObject
-    (thePoint4->GetStudyID(), thePoint4->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
+  Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
+  Handle(::GEOM_Object) aPoint3 = GetObjectImpl(thePoint3);
+  Handle(::GEOM_Object) aPoint4 = GetObjectImpl(thePoint4);
 
   if (aShape.IsNull() ||
       aPoint1.IsNull() || aPoint2.IsNull() ||
       aPoint3.IsNull() || aPoint4.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetFaceByPoints(aShape, aPoint1, aPoint2, aPoint3, aPoint4);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -409,30 +400,24 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByPoints
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByEdges
                                                (GEOM::GEOM_Object_ptr theShape,
-                                               GEOM::GEOM_Object_ptr theEdge1,
-                                               GEOM::GEOM_Object_ptr theEdge2)
+                                                GEOM::GEOM_Object_ptr theEdge1,
+                                                GEOM::GEOM_Object_ptr theEdge2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      theEdge1 == NULL || theEdge2 == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) anEdge1 = GetOperations()->GetEngine()->GetObject
-    (theEdge1->GetStudyID(), theEdge1->GetEntry());
-  Handle(GEOM_Object) anEdge2 = GetOperations()->GetEngine()->GetObject
-    (theEdge2->GetStudyID(), theEdge2->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) anEdge1 = GetObjectImpl(theEdge1);
+  Handle(::GEOM_Object) anEdge2 = GetObjectImpl(theEdge2);
 
   if (aShape.IsNull() ||
       anEdge1.IsNull() || anEdge2.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetFaceByEdges(aShape, anEdge1, anEdge2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -446,25 +431,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByEdges
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetOppositeFace (GEOM::GEOM_Object_ptr theShape,
-                                                                GEOM::GEOM_Object_ptr theFace)
+                                                                 GEOM::GEOM_Object_ptr theFace)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL || theFace == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject
-    (theFace->GetStudyID(), theFace->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aFace = GetObjectImpl(theFace);
 
   if (aShape.IsNull() || aFace.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetOppositeFace(aShape, aFace);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -478,25 +459,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetOppositeFace (GEOM::GEOM_Obje
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceNearPoint (GEOM::GEOM_Object_ptr theShape,
-                                                                 GEOM::GEOM_Object_ptr thePoint)
+                                                                  GEOM::GEOM_Object_ptr thePoint)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL || thePoint == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
 
   if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetFaceNearPoint(aShape, aPoint);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -510,25 +487,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceNearPoint (GEOM::GEOM_Obj
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Object_ptr theShape,
-                                                                 GEOM::GEOM_Object_ptr theVector)
+                                                                  GEOM::GEOM_Object_ptr theVector)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL || theVector == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
-    (theVector->GetStudyID(), theVector->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
 
   if (aShape.IsNull() || aVector.IsNull()) return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetFaceByNormale(aShape, aVector);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -536,6 +509,37 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetShapesNearPoint
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetShapesNearPoint
+                      (GEOM::GEOM_Object_ptr theShape,
+                       GEOM::GEOM_Object_ptr thePoint,
+                       CORBA::Long           theShapeType,
+                       CORBA::Double         theTolerance)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Get the reference Objects
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
+
+  if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
+
+  // Create the Shape
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->GetShapesNearPoint(aShape, aPoint, theShapeType, theTolerance);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  ExplodeCompoundOfBlocks
@@ -543,20 +547,16 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj
 //=============================================================================
 GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks
                                           (GEOM::GEOM_Object_ptr theCompound,
-                                          const CORBA::Long     theMinNbFaces,
-                                          const CORBA::Long     theMaxNbFaces)
+                                           const CORBA::Long     theMinNbFaces,
+                                           const CORBA::Long     theMaxNbFaces)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return aSeq._retn();
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return aSeq._retn();
 
   //Explode
@@ -568,7 +568,7 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks
   Standard_Integer aLength = aHSeq->Length();
   aSeq->length(aLength);
   for (Standard_Integer i = 1; i <= aLength; i++)
-    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+    aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
 
   return aSeq._retn();
 }
@@ -580,9 +580,9 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::ExplodeCompoundOfBlocks
 //=============================================================================
 CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks
                                           (GEOM::GEOM_Object_ptr theCompound,
-                                          const CORBA::Long     theMinNbFaces,
-                                          const CORBA::Long     theMaxNbFaces,
-                                          CORBA::Long&          theNbBlocks)
+                                           const CORBA::Long     theMinNbFaces,
+                                           const CORBA::Long     theMaxNbFaces,
+                                           CORBA::Long&          theNbBlocks)
 {
   theNbBlocks = 0;
   CORBA::Boolean isComp = false;
@@ -590,20 +590,16 @@ CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return isComp;
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return isComp;
 
   //Check
   Standard_Integer nbBlocks = 0;
   isComp = GetOperations()->IsCompoundOfBlocks(aCompound,
-                                              theMinNbFaces,
-                                              theMaxNbFaces,
-                                              nbBlocks);
+                                               theMinNbFaces,
+                                               theMaxNbFaces,
+                                               nbBlocks);
   if (!GetOperations()->IsDone())
     return isComp;
 
@@ -618,24 +614,22 @@ CORBA::Boolean GEOM_IBlocksOperations_i::IsCompoundOfBlocks
 //=============================================================================
 CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
                                           (GEOM::GEOM_Object_ptr theCompound,
-                                          GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors)
+                                           const CORBA::Double   theToleranceC1,
+                                           GEOM::GEOM_IBlocksOperations::BCErrors_out theErrors)
 {
   CORBA::Boolean isComp = false;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return isComp;
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return isComp;
 
   //Check
-  list<GEOMImpl_IBlocksOperations::BCError> errList;
-  isComp = GetOperations()->CheckCompoundOfBlocks(aCompound, errList);
+  std::list<GEOMImpl_IBlocksOperations::BCError> errList;
+  isComp = GetOperations()->CheckCompoundOfBlocks
+    (aCompound, theToleranceC1, errList);
   if (!GetOperations()->IsDone())
     return isComp;
 
@@ -645,7 +639,7 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
   anErrArray->length(nbErr);
 
   // fill the local CORBA array with values from lists
-  list<GEOMImpl_IBlocksOperations::BCError>::iterator errIt = errList.begin();
+  std::list<GEOMImpl_IBlocksOperations::BCError>::iterator errIt = errList.begin();
   int i = 0;
   for (; errIt != errList.end(); i++, errIt++) {
     GEOM::GEOM_IBlocksOperations::BCError_var anError =
@@ -673,11 +667,11 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
       break;
     }
 
-    list<int> sshList = errStruct.incriminated;
+    std::list<int> sshList = errStruct.incriminated;
     GEOM::ListOfLong_var anIncrims = new GEOM::ListOfLong();
     anIncrims->length(sshList.size());
 
-    list<int>::iterator sshIt = sshList.begin();
+    std::list<int>::iterator sshIt = sshList.begin();
     int jj = 0;
     for (; sshIt != sshList.end(); jj++, sshIt++) {
       anIncrims[jj] = *sshIt;
@@ -701,16 +695,14 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
 //=============================================================================
 char* GEOM_IBlocksOperations_i::PrintBCErrors
                       (GEOM::GEOM_Object_ptr theCompound,
-                      const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors)
+                       const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors)
 {
   //Get the reference Compound
-  if (theCompound == NULL) return NULL;
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return NULL;
 
   // Convert the errors sequence
-  list<GEOMImpl_IBlocksOperations::BCError> anErrors;
+  std::list<GEOMImpl_IBlocksOperations::BCError> anErrors;
   int nbErr = theErrors.length();
   int ie = 0;
   for (; ie < nbErr; ie++) {
@@ -749,32 +741,92 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
   }
 
   TCollection_AsciiString aDescr = GetOperations()->PrintBCErrors(aCompound, anErrors);
-  return CORBA::string_dup(aDescr.ToCString());    
+  return CORBA::string_dup(aDescr.ToCString());
 }
 
 //=============================================================================
 /*!
- *  RemoveExtraEdges
+ *  GetNonBlocks
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape)
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetNonBlocks
+                                      (GEOM::GEOM_Object_ptr theShape,
+                                       const CORBA::Double   theToleranceC1,
+                                       GEOM::GEOM_Object_out theNonQuads)
 {
   GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::GEOM_Object_var aNonQuads;
+
+  theNonQuads = aNonQuads._retn();
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return aGEOMObject._retn();
+  //Get the reference Objects
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  if (aShape.IsNull()) return aGEOMObject._retn();
+
+  //Get the result
+  Handle(::GEOM_Object) aFaces;
+  Handle(::GEOM_Object) anObject =
+    GetOperations()->GetNonBlocks(aShape, theToleranceC1, aFaces);
+  if (!GetOperations()->IsDone())
+    return aGEOMObject._retn();
+
+  if (!aFaces.IsNull())
+    theNonQuads = GetObject(aFaces);
+
+  if (anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  RemoveExtraEdges
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges
+                                      (GEOM::GEOM_Object_ptr theShape,
+                                       CORBA::Long           theOptimumNbFaces)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
 
   //Get the reference Objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
+  if (aShape.IsNull()) return aGEOMObject._retn();
 
+  //Get the result
+  Handle(::GEOM_Object) anObject = GetOperations()->RemoveExtraEdges(aShape, theOptimumNbFaces);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  UnionFaces
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::UnionFaces
+                                      (GEOM::GEOM_Object_ptr theShape)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference Objects
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return aGEOMObject._retn();
 
   //Get the result
-  Handle(GEOM_Object) anObject =
-    GetOperations()->RemoveExtraEdges(aShape);
+  Handle(::GEOM_Object) anObject = GetOperations()->UnionFaces(aShape);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -793,16 +845,12 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Obje
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return aGEOMObject._retn();
 
   //Get the result
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->CheckAndImprove(aCompound);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -816,25 +864,21 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Obje
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockNearPoint (GEOM::GEOM_Object_ptr theCompound,
-                                                                  GEOM::GEOM_Object_ptr thePoint)
+                                                                   GEOM::GEOM_Object_ptr thePoint)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL || thePoint == NULL) return aGEOMObject._retn();
-
   //Get the reference Objects
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
+  Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
 
   if (aCompound.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
 
   //Get the block
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetBlockNearPoint(aCompound, aPoint);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -848,19 +892,15 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockNearPoint (GEOM::GEOM_Ob
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Object_ptr theCompound,
-                                                                const GEOM::ListOfGO& theParts)
+                                                                 const GEOM::ListOfGO& theParts)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return aGEOMObject._retn();
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return aGEOMObject._retn();
 
   //Get the parts
@@ -869,15 +909,13 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Obje
 
   aLen = theParts.length();
   for (ind = 0; ind < aLen; ind++) {
-    if (theParts[ind] == NULL) return aGEOMObject._retn();
-    Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
-      (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry());
+    Handle(::GEOM_Object) aSh = GetObjectImpl(theParts[ind]);
     if (aSh.IsNull()) return aGEOMObject._retn();
     aParts->Append(aSh);
   }
 
   //Get the Block
-  Handle(GEOM_Object) anObject =
+  Handle(::GEOM_Object) anObject =
     GetOperations()->GetBlockByParts(aCompound, aParts);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -891,19 +929,15 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetBlockByParts (GEOM::GEOM_Obje
  */
 //=============================================================================
 GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_ptr theCompound,
-                                                           const GEOM::ListOfGO& theParts)
+                                                            const GEOM::ListOfGO& theParts)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCompound == NULL) return aSeq._retn();
-
   //Get the reference Compound
-  Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
-    (theCompound->GetStudyID(), theCompound->GetEntry());
-
+  Handle(::GEOM_Object) aCompound = GetObjectImpl(theCompound);
   if (aCompound.IsNull()) return aSeq._retn();
 
   //Get the parts
@@ -912,9 +946,7 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_pt
 
   aLen = theParts.length();
   for (ind = 0; ind < aLen; ind++) {
-    if (theParts[ind] == NULL) return aSeq._retn();
-    Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
-      (theParts[ind]->GetStudyID(), theParts[ind]->GetEntry());
+    Handle(::GEOM_Object) aSh = GetObjectImpl(theParts[ind]);
     if (aSh.IsNull()) return aSeq._retn();
     aParts->Append(aSh);
   }
@@ -928,7 +960,7 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_pt
   Standard_Integer aLength = aHSeq->Length();
   aSeq->length(aLength);
   for (Standard_Integer i = 1; i <= aLength; i++)
-    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+    aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
 
   return aSeq._retn();
 }
@@ -940,29 +972,25 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::GetBlocksByParts (GEOM::GEOM_Object_pt
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation1D
                                               (GEOM::GEOM_Object_ptr theBlock,
-                                              const CORBA::Long     theDirFace1,
-                                              const CORBA::Long     theDirFace2,
-                                              const CORBA::Long     theNbTimes)
+                                               const CORBA::Long     theDirFace1,
+                                               const CORBA::Long     theDirFace2,
+                                               const CORBA::Long     theNbTimes)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-   //Set a not done flag
+  //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBlock == NULL) return aGEOMObject._retn();
-
-   //Get the object itself and the vector of translation
-   Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
-     (theBlock->GetStudyID(), theBlock->GetEntry());
-
-   if (aBasicObject.IsNull()) return aGEOMObject._retn();
+  //Get the object itself and the vector of translation
+  Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theBlock);
+  if (aBasicObject.IsNull()) return aGEOMObject._retn();
 
-   //Perform the transformation
-   Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation1D
-     (aBasicObject, theDirFace1, theDirFace2, theNbTimes);
-   if (!GetOperations()->IsDone() || anObject.IsNull())  return aGEOMObject._retn();
+  //Perform the transformation
+  Handle(::GEOM_Object) anObject = GetOperations()->MakeMultiTransformation1D
+    (aBasicObject, theDirFace1, theDirFace2, theNbTimes);
+  if (!GetOperations()->IsDone() || anObject.IsNull())  return aGEOMObject._retn();
 
-   return GetObject(anObject);
+  return GetObject(anObject);
 }
 
 //=============================================================================
@@ -972,28 +1000,24 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation1D
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::MakeMultiTransformation2D
                                            (GEOM::GEOM_Object_ptr theBlock,
-                                           const CORBA::Long     theDirFace1U,
-                                           const CORBA::Long     theDirFace2U,
-                                           const CORBA::Long     theNbTimesU,
-                                           const CORBA::Long     theDirFace1V,
-                                           const CORBA::Long     theDirFace2V,
-                                           const CORBA::Long     theNbTimesV)
+                                            const CORBA::Long     theDirFace1U,
+                                            const CORBA::Long     theDirFace2U,
+                                            const CORBA::Long     theNbTimesU,
+                                            const CORBA::Long     theDirFace1V,
+                                            const CORBA::Long     theDirFace2V,
+                                            const CORBA::Long     theNbTimesV)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBlock == NULL) return aGEOMObject._retn();
-
   //Get the object itself
-  Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
-    (theBlock->GetStudyID(), theBlock->GetEntry());
-
+  Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theBlock);
   if (aBasicObject.IsNull()) return aGEOMObject._retn();
 
   //Perform the transformation
-  Handle(GEOM_Object) anObject = GetOperations()->MakeMultiTransformation2D
+  Handle(::GEOM_Object) anObject = GetOperations()->MakeMultiTransformation2D
     (aBasicObject,
      theDirFace1U, theDirFace2U, theNbTimesU,
      theDirFace1V, theDirFace2V, theNbTimesV);
@@ -1014,12 +1038,8 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::Propagate (GEOM::GEOM_Object_ptr theSh
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return aSeq._retn();
-
   //Get the reference Shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return aSeq._retn();
 
   //Get the Propagation chains
@@ -1031,7 +1051,7 @@ GEOM::ListOfGO* GEOM_IBlocksOperations_i::Propagate (GEOM::GEOM_Object_ptr theSh
   Standard_Integer aLength = aHSeq->Length();
   aSeq->length(aLength);
   for (Standard_Integer i = 1; i <= aLength; i++)
-    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+    aSeq[i-1] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i)));
 
   return aSeq._retn();
 }