]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for bug 10041: Loading the dumped study with imported 'ex19_sphereINcube.py'...
authorjfa <jfa@opencascade.com>
Tue, 7 Mar 2006 13:58:43 +0000 (13:58 +0000)
committerjfa <jfa@opencascade.com>
Tue, 7 Mar 2006 13:58:43 +0000 (13:58 +0000)
src/GEOM/GEOM_PythonDump.cxx
src/GEOM/GEOM_PythonDump.hxx
src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx
src/GEOMImpl/GEOMImpl_IGroupOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx

index 86c576c643e8349d9776498b51122467207b55fc..985136d7078683377c684f0087b6e0362372c805 100644 (file)
 
 #include <TDF_Tool.hxx>
 
+#include <TopAbs.hxx>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
 namespace GEOM
 {
   size_t TPythonDump::myCounter = 0;
@@ -89,6 +94,14 @@ namespace GEOM
     return *this;
   }
 
+  TPythonDump& TPythonDump::operator<< (const TopAbs_ShapeEnum theArg)
+  {
+    myStream<<"geompy.ShapeType[\"";
+    TopAbs::Print(theArg, myStream);
+    myStream<<"\"]";
+    return *this;
+  }
+
   TPythonDump& TPythonDump::operator<< (const Handle(GEOM_Object)& theObject)
   {
     TCollection_AsciiString anEntry;
@@ -96,4 +109,40 @@ namespace GEOM
     myStream << anEntry.ToCString();
     return *this;
   }
+
+  Handle(GEOM_Object) GetCreatedLast(const Handle(GEOM_Object)& theObj1,
+                                     const Handle(GEOM_Object)& theObj2)
+  {
+    if (theObj1.IsNull()) return theObj2;
+    if (theObj2.IsNull()) return theObj1;
+
+    TColStd_ListOfInteger aTags1, aTags2;
+    TDF_Tool::TagList(theObj1->GetEntry(), aTags1);
+    TDF_Tool::TagList(theObj2->GetEntry(), aTags2);
+    TColStd_ListIteratorOfListOfInteger aListIter1(aTags1), aListIter2(aTags2);
+    for (; aListIter1.More(); aListIter1.Next()) {
+      if (!aListIter2.More())
+        return theObj1; // anObj1 is stored under anObj2
+
+      if (aListIter1.Value() > aListIter2.Value())
+        return theObj1;
+      else if (aListIter1.Value() < aListIter2.Value())
+        return theObj2;
+    }
+    return theObj1;
+  }
+
+  Handle(GEOM_Object) GetCreatedLast(const Handle(TColStd_HSequenceOfTransient)& theObjects)
+  {
+    Handle(GEOM_Object) anObject, aLatest;
+    int i, aLen = theObjects->Length();
+    if (aLen < 1)
+      return aLatest;
+
+    for (i = 1; i <= aLen; i++) {
+      anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
+      aLatest = GetCreatedLast(aLatest, anObject);
+    }
+    return aLatest;
+  }
 }
index 0288f4b1a16e6cf423e6c43b9c6cc124c3ac607a..af5f2a52ee4f443f509a25ec383b9d03a4652446 100644 (file)
@@ -49,8 +49,18 @@ namespace GEOM
     Standard_EXPORT TPythonDump& operator<< (float theArg);
     Standard_EXPORT TPythonDump& operator<< (const void* theArg);
     Standard_EXPORT TPythonDump& operator<< (const char* theArg);
+    Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg);
     Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_Object)& theObject);
   };
+
+  /*! Returns an object from two given, which has the latest entry
+   */
+  Handle(GEOM_Object) GetCreatedLast (const Handle(GEOM_Object)& theObj1,
+                                      const Handle(GEOM_Object)& theObj2);
+
+  /*! Returns an object from \a theObjects, which has the latest entry
+   */
+  Handle(GEOM_Object) GetCreatedLast (const Handle(TColStd_HSequenceOfTransient)& theObjects);
 }
 
 #endif
index 2cbca5805d1768fcb62be1ad577aa121b52b0549..124ea60f98db3c48986ec59bcad696e1aa70fc67 100644 (file)
@@ -537,12 +537,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint
 
   //The GetPoint() doesn't change object so no new function is required.
   Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << aResult << " = geompy.GetPoint(" << theShape << ", "
-      << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
+    << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
 
   SetErrorCode(OK);
   return aResult;
@@ -2447,12 +2446,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound
 
   //The explode doesn't change object so no new function is required.
   aFunction = theCompound->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
-    << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
-      << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
+  GEOM::TPythonDump(aFunction, /*append=*/true)
+    << "[" << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
+    << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
 
   SetErrorCode(OK);
   return aBlocks;
@@ -3118,11 +3116,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate
 
   // The Propagation doesn't change object so no new function is required.
   Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
   // Make a Python command
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
-    << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
+  GEOM::TPythonDump(aFunction, /*append=*/true)
+    << "[" << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
 
   SetErrorCode(OK);
   return aSeq;
index 67b43781fca305d3397d992f2fdc5033e6ddb4d1..353ac3530a1036dd16832a27e8167763ca8dcf6b 100644 (file)
@@ -75,7 +75,7 @@ GEOMImpl_IGroupOperations::~GEOMImpl_IGroupOperations()
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
-       (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum  theShapeType)
+       (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
 {
   SetErrorCode(KO);
 
@@ -94,14 +94,12 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
 
   //Make a Python command
   Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
-  //TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
-  //GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup
   GEOM::TPythonDump(aFunction) << aGroup
-    << " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")";
+    << " = geompy.CreateGroup(" << theMainShape << ", " << theShapeType << ")";
 
   SetErrorCode(OK);
-  return aGroup; 
+  return aGroup;
 }
 
 //=============================================================================
@@ -156,9 +154,7 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS
   }
 
   //Make a Python command
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
-
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")";
 
   SetErrorCode(OK);
@@ -222,9 +218,7 @@ void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int
   }
 
   //Make a Python command 
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
-
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")";
 
   SetErrorCode(OK);
@@ -242,6 +236,12 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
   SetErrorCode(KO);
   if (theGroup.IsNull()) return;
 
+  Standard_Integer aLen = theSubShapes->Length();
+  if (aLen < 1) {
+    SetErrorCode("The list is empty");
+    return;
+  }
+
   Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
   if (aFunction.IsNull()) return;
 
@@ -277,7 +277,7 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
   TopExp::MapShapes(aMainShape, mapIndices);
 
   // Get IDs of sub-shapes to add
-  Standard_Integer i, new_id, aLen = theSubShapes->Length();
+  Standard_Integer i, new_id;
   for (i = 1; i <= aLen; i++) {
     Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
 
@@ -363,11 +363,13 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup,
     aSSI.SetIndices(aNewSeq);
   }
 
-  //Make a Python command 
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+  //Make a Python command
+  Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
+  aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
+  Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
 
-  GEOM::TPythonDump pd (aFunction);
-  pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", [";
+  GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
+  pd << "geompy.UnionList(" << theGroup << ", [";
 
   for (i = 1; i <= aLen; i++) {
     Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@@ -388,6 +390,12 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
   SetErrorCode(KO);
   if (theGroup.IsNull()) return;
 
+  Standard_Integer aLen = theSubShapes->Length();
+  if (aLen < 1) {
+    SetErrorCode("The list is empty");
+    return;
+  }
+
   Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
   if (aFunction.IsNull()) return;
 
@@ -424,7 +432,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
   TopExp::MapShapes(aMainShape, mapIndices);
 
   // Get IDs of sub-shapes to be removed
-  Standard_Integer i, rem_id, aLen = theSubShapes->Length();
+  Standard_Integer i, rem_id;
   for (i = 1; i <= aLen; i++) {
     Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
 
@@ -514,10 +522,12 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
   }
 
   //Make a Python command
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+  Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
+  aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
+  Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
 
-  GEOM::TPythonDump pd (aFunction);
-  pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", [";
+  GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
+  pd << "geompy.DifferenceList(" << theGroup << ", [";
 
   for (i = 1; i <= aLen; i++) {
     Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
@@ -526,6 +536,7 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup,
 
   SetErrorCode(OK);
 }
+
 //=============================================================================
 /*!
  *  UnionIDs
@@ -537,6 +548,12 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
   SetErrorCode(KO);
   if (theGroup.IsNull()) return;
 
+  Standard_Integer aLen = theSubShapes->Length();
+  if (aLen < 1) {
+    SetErrorCode("The list is empty");
+    return;
+  }
+
   Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
   if (aFunction.IsNull()) return;
 
@@ -572,7 +589,7 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
   TopExp::MapShapes(aMainShape, mapIndices);
 
   // Get IDs of sub-shapes to add
-  Standard_Integer i, new_id, aLen = theSubShapes->Length();
+  Standard_Integer i, new_id;
   for (i = 1; i <= aLen; i++) {
     new_id = theSubShapes->Value(i);
 
@@ -594,6 +611,13 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup,
     aSSI.SetIndices(aNewSeq);
   }
 
+  //Make a Python command
+  GEOM::TPythonDump pd (aFunction, /*append=*/true);
+  pd << "geompy.UnionIDs(" << theGroup << ", [";
+  for (i = 1; i < aLen; i++)
+    pd << theSubShapes->Value(i) << ", ";
+  pd << theSubShapes->Value(aLen) << "])";
+
   SetErrorCode(OK);
 }
 
@@ -608,6 +632,12 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
   SetErrorCode(KO);
   if (theGroup.IsNull()) return;
 
+  Standard_Integer aLen = theSubShapes->Length();
+  if (aLen < 1) {
+    SetErrorCode("The list is empty");
+    return;
+  }
+
   Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
   if (aFunction.IsNull()) return;
 
@@ -644,7 +674,7 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
   TopExp::MapShapes(aMainShape, mapIndices);
 
   // Get IDs of sub-shapes to be removed
-  Standard_Integer i, rem_id, aLen = theSubShapes->Length();
+  Standard_Integer i, rem_id;
   for (i = 1; i <= aLen; i++) {
     rem_id = theSubShapes->Value(i);
     if (mapIDsCurrent.Contains(rem_id)) {
@@ -666,6 +696,13 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup,
     aSSI.SetIndices(aNewSeq);
   }
 
+  //Make a Python command
+  GEOM::TPythonDump pd (aFunction, /*append=*/true);
+  pd << "geompy.DifferenceIDs(" << theGroup << ", [";
+  for (i = 1; i < aLen; i++)
+    pd << theSubShapes->Value(i) << ", ";
+  pd << theSubShapes->Value(aLen) << "])";
+
   SetErrorCode(OK);
 }
 
@@ -709,9 +746,7 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object)
   if (aMainShape.IsNull()) return NULL;
 
   //Make a Python command
-  TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription();
-
-  GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t"
+  GEOM::TPythonDump(aGroupFunction, /*append=*/true)
     << aMainShape << " = geompy.GetMainShape(" << theGroup << ")";
 
   SetErrorCode(OK);
@@ -726,12 +761,12 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object)
 Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GEOM_Object) theGroup)
 {
   SetErrorCode(KO);
-  
-   if(theGroup.IsNull()) return NULL;
+
+  if(theGroup.IsNull()) return NULL;
 
   Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
   if(aFunction.IsNull()) return NULL;
-  
+
   GEOM_ISubShape aSSI(aFunction);
   Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
   if(aSeq.IsNull()) return NULL;
index e0d2ae90c092725c69b6fe9a04f6775b6dd4513a..7c41f7342403d2c6a2b806db770c006517f54b27 100644 (file)
@@ -93,9 +93,6 @@
 #include <TColStd_HArray1OfInteger.hxx>
 
 #include <vector>
-//#include <iostream>
-
-//#include <OSD_Timer.hxx>
 
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
@@ -533,9 +530,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
                                            const Standard_Integer theShapeType,
                                            const Standard_Boolean isSorted)
 {
-//  OSD_Timer timer1, timer2, timer3, timer4;
-//  timer1.Start();
-
   SetErrorCode(KO);
 
   if (theShape.IsNull()) return NULL;
@@ -573,15 +567,9 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
     return aSeq;
   }
 
-//  timer1.Stop();
-//  timer2.Start();
-
   if (isSorted)
     SortShapes(listShape);
 
-//  timer2.Stop();
-//  timer3.Start();
-
   TopTools_IndexedMapOfShape anIndices;
   TopExp::MapShapes(aShape, anIndices);
   Handle(TColStd_HArray1OfInteger) anArray;
@@ -605,26 +593,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
   anAsciiList.Trunc(anAsciiList.Length() - 1);
 
   aFunction = theShape->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
-  GEOM::TPythonDump pd (aFunction);
-  pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString();
+  GEOM::TPythonDump pd (aFunction, /*append=*/true);
+  pd << "[" << anAsciiList.ToCString();
   pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
-  pd << theShape << ", " << theShapeType << ")";
+  pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
 
   SetErrorCode(OK);
 
-//  timer4.Stop();
-
-//  cout << "Explosure takes:" << endl;
-//  timer1.Show();
-//  cout << "Sorting takes:" << endl;
-//  timer2.Show();
-//  cout << "Sub-shapes addition takes:" << endl;
-//  timer3.Show();
-//  cout << "Update Description takes:" << endl;
-//  timer4.Show();
-
   return aSeq;
 }
 
@@ -687,13 +663,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs
   }
 
   Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
   //Make a Python command
-  GEOM::TPythonDump pd (aFunction);
-  pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll";
+  GEOM::TPythonDump pd (aFunction, /*append=*/true);
+  pd << "listSubShapeIDs = geompy.SubShapeAll";
   pd << (isSorted ? "SortedIDs(" : "IDs(");
-  pd << theShape << ", " << theShapeType << ")";
+  pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -873,11 +848,10 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetFreeFacesIDs
 
   //The explode doesn't change object so no new function is required.
   Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << anOldDescr.ToCString()
-    << "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
+  GEOM::TPythonDump(aFunction, /*append=*/true)
+    << "listFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -942,7 +916,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
 
   GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
     << "] = geompy.GetSharedShapes(" << theShape1 << ", "
-      << theShape2 << ", " << theShapeType << ")";
+      << theShape2 << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -1084,9 +1058,6 @@ Handle(TColStd_HSequenceOfInteger)
                                                     GEOMAlgo_State              theState)
 {
   Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
-//  MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
-//  OSD_Timer timer1;
-//  timer1.Start();
 
   // Check presence of triangulation, build if need
   if (!CheckTriangulation(theShape))
@@ -1112,19 +1083,7 @@ Handle(TColStd_HSequenceOfInteger)
   // Default value=0
   aFinder.SetNbPntsMax(100);
 
-//  timer1.Stop();
-//  timer1.Show();
-
-//  MESSAGE("--------------------------- Perform on Plane takes:");
-//  timer1.Reset();
-//  timer1.Start();
   aFinder.Perform();
-//  timer1.Stop();
-//  timer1.Show();
-
-//  MESSAGE("--------------------------- GetShapesOnPlane phase 3 takes:");
-//  timer1.Reset();
-//  timer1.Start();
 
   // Interprete results
   Standard_Integer iErr = aFinder.ErrorStatus();
@@ -1149,13 +1108,6 @@ Handle(TColStd_HSequenceOfInteger)
     return aSeqOfIDs;
   }
 
-//  timer1.Stop();
-//  timer1.Show();
-
-//  MESSAGE("--------------------------- GetShapesOnPlane phase 4 takes:");
-//  timer1.Reset();
-//  timer1.Start();
-
   // Fill sequence of object IDs
   aSeqOfIDs = new TColStd_HSequenceOfInteger;
 
@@ -1167,8 +1119,7 @@ Handle(TColStd_HSequenceOfInteger)
     int id = anIndices.FindIndex(itSub.Value());
     aSeqOfIDs->Append(id);
   }
-//  timer1.Stop();
-//  timer1.Show();
+
   return aSeqOfIDs;
 }
 
@@ -1250,10 +1201,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
 {
   SetErrorCode(KO);
 
-//  MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
-//  OSD_Timer timer1;
-//  timer1.Start();
-
   if (theShape.IsNull() || theAx1.IsNull()) return NULL;
 
   TopoDS_Shape aShape = theShape->GetValue();
@@ -1277,13 +1224,6 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
   if ( aSeq.IsNull() || aSeq->Length() == 0 )
     return NULL;
 
-//  timer1.Stop();
-//  timer1.Show();
-
-//  MESSAGE("--------------------------- GetShapesOnPlane phase 5 takes:");
-//  timer1.Reset();
-//  timer1.Start();
-
   // Make a Python command
 
   Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
@@ -1291,7 +1231,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan
 
   GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
     << "] = geompy.GetShapesOnPlane(" << theShape << ", "
-      << theShapeType << ", " << theAx1 << ", " << theState << ")";
+      << aShapeType << ", " << theAx1 << ", " << theState << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -1340,7 +1280,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli
   Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
 
   GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
-    << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType
+    << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType
       << ", " << theAxis << ", " << theRadius << ", " << theState << ")";
 
   SetErrorCode(OK);
@@ -1393,31 +1333,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe
   Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
 
   GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
-    << "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType
+    << "] = geompy.GetShapesOnSphere(" << theShape << ", " << aShapeType
       << ", " << theCenter << ", " << theRadius << ", " << theState << ")";
 
   SetErrorCode(OK);
   return aSeq;
 }
 
-//=======================================================================
-//function : getCreatedLast
-  /*!
-   * \brief Select the object created last
-    * \param theObj1 - Object 1
-    * \param theObj2 - Object 2
-    * \retval Handle(GEOM_Object) - selected object
-   */
-//=======================================================================
-
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::getCreatedLast(const Handle(GEOM_Object)& theObj1,
-                                                               const Handle(GEOM_Object)& theObj2)
-{
-  if ( theObj1.IsNull() ) return theObj2;
-  if ( theObj2.IsNull() ) return theObj1;
-  return ( theObj1->GetEntry().Tag() > theObj2->GetEntry().Tag() ) ? theObj1 : theObj2;
-}
-
 //=============================================================================
 /*!
  *  GetShapesOnPlaneIDs
@@ -1452,13 +1374,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneI
   aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState );
 
   // The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
-  Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAx1)->GetLastFunction();
+  Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
 
   // Make a Python command
-  const bool append = true;
-  GEOM::TPythonDump(aFunction,append)
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "listShapesOnPlane = geompy.GetShapesOnPlaneIDs"
-    << "(" << theShape << "," << theShapeType << "," << theAx1 << "," << theState << ")";
+    << "(" << theShape << "," << aShapeType << "," << theAx1 << "," << theState << ")";
 
   SetErrorCode(OK);
   return aSeq;
@@ -1499,13 +1420,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylind
   aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState );
 
   // The GetShapesOnCylinder() doesn't change object so no new function is required.
-  Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAxis)->GetLastFunction();
+  Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAxis)->GetLastFunction();
 
   // Make a Python command
-  const bool append = true;
-  GEOM::TPythonDump(aFunction,append)
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
-    << "(" << theShape << ", " << theShapeType << ", " << theAxis << ", "
+    << "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
     << theRadius << ", " << theState << ")";
 
   SetErrorCode(OK);
@@ -1550,13 +1470,12 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnSphere
   aSeq = getShapesOnSurfaceIDs( aSphere, aShape, aShapeType, theState );
   
   // The GetShapesOnSphere() doesn't change object so no new function is required.
-  Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theCenter)->GetLastFunction();
+  Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theCenter)->GetLastFunction();
 
   // Make a Python command
-  const bool append = true;
-  GEOM::TPythonDump(aFunction,append)
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
-    << "(" << theShape << ", " << theShapeType << ", " << theCenter << ", "
+    << "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
     << theRadius << ", " << theState << ")";
 
   SetErrorCode(OK);
@@ -1738,7 +1657,7 @@ Handle(TColStd_HSequenceOfTransient)
   GEOM::TPythonDump(aFunction)
     << "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnQuadrangle("
     << theShape << ", "
-    << theShapeType << ", "
+    << TopAbs_ShapeEnum(theShapeType) << ", "
     << theTopLeftPoint << ", "
     << theTopRigthPoint << ", "
     << theBottomLeftPoint << ", "
@@ -1788,17 +1707,16 @@ Handle(TColStd_HSequenceOfInteger)
   // Make a Python command
 
   // The GetShapesOnCylinder() doesn't change object so no new function is required.
-  Handle(GEOM_Object) lastObj = getCreatedLast(theShape,theTopLeftPoint);
-  lastObj = getCreatedLast(lastObj,theTopRigthPoint);
-  lastObj = getCreatedLast(lastObj,theBottomRigthPoint);
-  lastObj = getCreatedLast(lastObj,theBottomLeftPoint);
+  Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
+  lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
+  lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
+  lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
   Handle(GEOM_Function) aFunction = lastObj->GetLastFunction();
 
-  const bool append = true;
-  GEOM::TPythonDump(aFunction,append)
+  GEOM::TPythonDump(aFunction, /*append=*/true)
     << "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs("
     << theShape << ", "
-    << theShapeType << ", "
+    << TopAbs_ShapeEnum(theShapeType) << ", "
     << theTopLeftPoint << ", "
     << theTopRigthPoint << ", "
     << theBottomLeftPoint << ", "
@@ -2099,6 +2017,7 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
     MidXYZ.SetValue(Index,
                    GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9);
   }
+
   // Sorting
   Standard_Integer aTemp;
   Standard_Boolean exchange, Sort = Standard_True;
@@ -2133,11 +2052,6 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
 //=======================================================================
 bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
 {
-//  MESSAGE("CheckTriangulation");
-//
-//  OSD_Timer timer1;
-//  timer1.Start();
-
   TopExp_Explorer exp (aShape, TopAbs_FACE);
   if (!exp.More()) {
     SetErrorCode("Shape without faces given");
@@ -2158,15 +2072,10 @@ bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
 
     Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
     Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-
-//    MESSAGE("Deflection = " << aDeflection);
-
     Standard_Real aHLRAngle = 0.349066;
 
     BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
   }
-//  timer1.Stop();
-//  timer1.Show();
 
   return true;
 }