Salome HOME
Migration to OCCT 7.0
[modules/geom.git] / src / GEOM_I / GEOM_ILocalOperations_i.cc
index c71a24780310ec41c406a41913376ee4388aa809..0d89b61d33d86b57b38706215c6dbbaf6206d4f6 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// 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
+// 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.
+// 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include <Standard_Stream.hxx>
 
 #include "GEOM_ILocalOperations_i.hh"
@@ -36,8 +37,8 @@
  */
 //=============================================================================
 GEOM_ILocalOperations_i::GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA,
-                                                 GEOM::GEOM_Gen_ptr theEngine,
-                                                 ::GEOMImpl_ILocalOperations* theImpl)
+                                                  GEOM::GEOM_Gen_ptr theEngine,
+                                                  ::GEOMImpl_ILocalOperations* theImpl)
      :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_ILocalOperations_i::GEOM_ILocalOperations_i");
@@ -64,16 +65,12 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFilletAll(aShapeRef, theR);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -88,27 +85,24 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theEdges)
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
   int ind = 0;
   int aLen = theEdges.length();
-  list<int> anEdges;
+  std::list<int> anEdges;
   for (; ind < aLen; ind++) {
     anEdges.push_back(theEdges[ind]);
   }
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFilletEdges(aShapeRef, theR, anEdges);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -127,23 +121,20 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
   int ind = 0;
   int aLen = theEdges.length();
-  list<int> anEdges;
+  std::list<int> anEdges;
   for (; ind < aLen; ind++) {
     anEdges.push_back(theEdges[ind]);
   }
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFilletEdgesR1R2(aShapeRef, theR1, theR2, anEdges);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -158,27 +149,24 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theFaces)
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
   int ind = 0;
   int aLen = theFaces.length();
-  list<int> aFaces;
+  std::list<int> aFaces;
   for (; ind < aLen; ind++) {
     aFaces.push_back(theFaces[ind]);
   }
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFilletFaces(aShapeRef, theR, aFaces);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -197,23 +185,20 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
   int ind = 0;
   int aLen = theFaces.length();
-  list<int> aFaces;
+  std::list<int> aFaces;
   for (; ind < aLen; ind++) {
     aFaces.push_back(theFaces[ind]);
   }
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFilletFacesR1R2(aShapeRef, theR1, theR2, aFaces);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -228,27 +213,24 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theVertexes)
+                       const GEOM::ListOfLong& theVertexes)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference vertex
   int ind = 0;
   int aLen = theVertexes.length();
-  list<int> aVertexes;
+  std::list<int> aVertexes;
   for (; ind < aLen; ind++) {
     aVertexes.push_back(theVertexes[ind]);
   }
 
   //Create the Fillet
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeFillet2D(aShapeRef, theR, aVertexes);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -256,6 +238,39 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeFillet1D
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet1D
+                      (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
+                       const GEOM::ListOfLong& theVertexes,
+                       CORBA::Boolean doIgnoreSecantVertices)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Get the reference shape (wire)
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
+  if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+  //Get the reference vertex
+  int ind = 0;
+  int aLen = theVertexes.length();
+  std::list<int> aVertexes;
+  for (; ind < aLen; ind++) {
+    aVertexes.push_back(theVertexes[ind]);
+  }
+
+  //Create the Fillet
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
+    GetOperations()->MakeFillet1D(aShapeRef, theR, aVertexes, doIgnoreSecantVertices);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakeChamferAll
@@ -266,16 +281,12 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferAll(aShapeRef, theD);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -290,20 +301,17 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      CORBA::Long theFace1, CORBA::Long theFace2)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       CORBA::Long theFace1, CORBA::Long theFace2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferEdge(aShapeRef, theD1, theD2, theFace1, theFace2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -317,20 +325,17 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      CORBA::Long theFace1, CORBA::Long theFace2)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       CORBA::Long theFace1, CORBA::Long theFace2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferEdgeAD(aShapeRef, theD, theAngle, theFace1, theFace2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -345,28 +350,25 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      const GEOM::ListOfLong& theFaces)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
   int ind = 0;
   int aLen = theFaces.length();
-  list<int> aFaces;
+  std::list<int> aFaces;
   for (; ind < aLen; ind++) {
     aFaces.push_back(theFaces[ind]);
   }
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferFaces(aShapeRef, theD1, theD2, aFaces);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -380,28 +382,25 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      const GEOM::ListOfLong& theFaces)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
   int ind = 0;
   int aLen = theFaces.length();
-  list<int> aFaces;
+  std::list<int> aFaces;
   for (; ind < aLen; ind++) {
     aFaces.push_back(theFaces[ind]);
   }
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferFacesAD(aShapeRef, theD, theAngle, aFaces);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -416,28 +415,25 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      const GEOM::ListOfLong& theEdges)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
   int ind = 0;
   int aLen = theEdges.length();
-  list<int> aEdges;
+  std::list<int> aEdges;
   for (; ind < aLen; ind++) {
     aEdges.push_back(theEdges[ind]);
   }
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferEdges(aShapeRef, theD1, theD2, aEdges);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -452,28 +448,25 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      const GEOM::ListOfLong& theEdges)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
   int ind = 0;
   int aLen = theEdges.length();
-  list<int> aEdges;
+  std::list<int> aEdges;
   for (; ind < aLen; ind++) {
     aEdges.push_back(theEdges[ind]);
   }
 
   //Create the Chamfer
-  Handle(GEOM_Object) anObject =
+  HANDLE_NAMESPACE(GEOM_Object) anObject =
     GetOperations()->MakeChamferEdgesAD(aShapeRef, theD, theAngle, aEdges);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -487,21 +480,18 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape,
-                                                             CORBA::Double theWeight,
-                                                             CORBA::Double theWaterDensity,
-                                                             CORBA::Double theMeshingDeflection)
+                                                              CORBA::Double theWeight,
+                                                              CORBA::Double theWaterDensity,
+                                                              CORBA::Double theMeshingDeflection)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Archimede
-  Handle(GEOM_Object) anObject = GetOperations()->MakeArchimede
+  HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeArchimede
     (aShapeRef, theWeight, theWaterDensity, theMeshingDeflection);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -517,13 +507,9 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_
 CORBA::Long GEOM_ILocalOperations_i::GetSubShapeIndex
   (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theSubShape)
 {
-  if (theShape == NULL || theSubShape == NULL) return -1;
-
   //Get the reference shapes
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
-    (theSubShape->GetStudyID(), theSubShape->GetEntry());
+  HANDLE_NAMESPACE(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
+  HANDLE_NAMESPACE(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
   if (aShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
 
   //Get the unique ID of <theSubShape> inside <theShape>