Salome HOME
PAL17233: Projection 2D doesn't work (bis)
[modules/geom.git] / src / GEOMImpl / GEOMImpl_ITransformOperations.cxx
index d7e2397c071b392340d9bb2b97c0962b76e6aaf4..9bf0da1bfd9e0194c80496d62ed93db602f76151 100644 (file)
@@ -1,34 +1,55 @@
-using namespace std;
-
-#include "GEOMImpl_ITransformOperations.hxx"
+// Copyright (C) 2005  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 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 <GEOMImpl_ITransformOperations.hxx>
 
 #include "utilities.h"
-#include "OpUtil.hxx"
-#include "Utils_ExceptHandlers.hxx"
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
 
 #include <TFunction_DriverTable.hxx>
 #include <TFunction_Driver.hxx>
 #include <TFunction_Logbook.hxx>
 #include <TDF_Tool.hxx>
 
-#include "GEOM_Function.hxx"
+#include <GEOM_Function.hxx>
+#include <GEOM_PythonDump.hxx>
 
-#include "GEOMImpl_TranslateDriver.hxx"
-#include "GEOMImpl_MirrorDriver.hxx"
-#include "GEOMImpl_OffsetDriver.hxx"
-#include "GEOMImpl_ScaleDriver.hxx"
-#include "GEOMImpl_RotateDriver.hxx"
-#include "GEOMImpl_PositionDriver.hxx"
+#include <GEOMImpl_TranslateDriver.hxx>
+#include <GEOMImpl_MirrorDriver.hxx>
+#include <GEOMImpl_OffsetDriver.hxx>
+#include <GEOMImpl_ScaleDriver.hxx>
+#include <GEOMImpl_RotateDriver.hxx>
+#include <GEOMImpl_PositionDriver.hxx>
 
-#include "GEOMImpl_ITranslate.hxx"
-#include "GEOMImpl_IMirror.hxx"
-#include "GEOMImpl_IOffset.hxx"
-#include "GEOMImpl_IScale.hxx"
-#include "GEOMImpl_IRotate.hxx"
-#include "GEOMImpl_IPosition.hxx"
+#include <GEOMImpl_ITranslate.hxx>
+#include <GEOMImpl_IMirror.hxx>
+#include <GEOMImpl_IOffset.hxx>
+#include <GEOMImpl_IScale.hxx>
+#include <GEOMImpl_IRotate.hxx>
+#include <GEOMImpl_IPosition.hxx>
 
-#include "GEOMImpl_Types.hxx"
+#include <GEOMImpl_Types.hxx>
 
+#include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
 //=============================================================================
@@ -89,6 +110,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -101,15 +125,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateTwoPoints(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
-  aDescr += (anEntry+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateTwoPoints("
+    << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -146,6 +163,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -158,14 +178,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZ(");
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theX)+", ");
-  aDescr += (TCollection_AsciiString(theY)+", ");
-  aDescr += (TCollection_AsciiString(theZ)+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ("
+    << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -205,6 +219,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -217,16 +234,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateTwoPointsCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
-  aDescr += (anEntry+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints("
+    << theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -265,6 +274,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -277,15 +289,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theX)+", ");
-  aDescr += (TCollection_AsciiString(theY)+", ");
-  aDescr += (TCollection_AsciiString(theZ)+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation("
+    << theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -324,6 +329,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -336,13 +344,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateVector(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theVector->GetEntry(), anEntry);
-  aDescr += (anEntry+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVector("
+                               << theObject << ", " << theVector << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -380,6 +383,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -392,14 +398,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.TranslateVectorCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theVector->GetEntry(), anEntry);
-  aDescr += (anEntry+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector("
+                               << theObject << ", " << theVector << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -439,6 +439,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -451,17 +454,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.Translate1D(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theVector->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theStep)+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes)+") ");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D("
+    << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -508,6 +502,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Translation driver failed");
       return NULL;
@@ -520,21 +517,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.Translate2D(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theVector->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theStep1)+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes2)+", ");
-  TDF_Tool::Entry(theVector2->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theStep2)+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes2)+") ");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D("
+    << theObject << ", " << theVector  << ", " << theStep1 << ", " << theNbTimes1
+      << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -573,6 +558,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -585,13 +573,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorPlane(");
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
-  aDescr += (anEntry + ") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPlane("
+                               << theObject << ", " << thePlane << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -628,6 +611,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -640,14 +626,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorPlaneCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
-  aDescr += (anEntry + ")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane("
+                               << theObject << ", " << thePlane << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -685,6 +665,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -697,13 +680,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorPoint(");
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
-  aDescr += (anEntry + ") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPoint("
+                               << theObject << ", " << thePoint << ")";
 
   SetErrorCode(OK);
   return NULL;
@@ -740,6 +718,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -752,14 +733,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorPointCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
-  aDescr += (anEntry + ")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint("
+                               << theObject << ", " << thePoint << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -797,6 +772,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -809,13 +787,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorAxis(");
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry + ") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorAxis("
+                               << theObject << ", " << theAxis << ")";
 
   SetErrorCode(OK);
   return NULL;
@@ -852,6 +825,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
 
   //Compute the mirror
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Mirror driver failed");
       return NULL;
@@ -864,14 +840,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry + " = ITransformOperations.MirrorAxisCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry + ", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry + ")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis("
+                               << theObject << ", " << theAxis << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -907,6 +877,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
 
   //Compute the offset
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Offset driver failed");
       return NULL;
@@ -919,12 +892,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.OffsetShape(");
-  aDescr += (anEntry+", ");
-  aDescr += TCollection_AsciiString(theOffset)+")";
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.OffsetShape("
+                               << theObject << ", " << theOffset << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -962,6 +931,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
 
   //Compute the offset
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Offset driver failed");
       return NULL;
@@ -974,13 +946,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.OffsetShapeCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += TCollection_AsciiString(theOffset)+")";
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
+                               << theObject << ", " << theOffset << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -1020,6 +987,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
 
   //Compute the scale
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Scale driver failed");
       return NULL;
@@ -1032,14 +1002,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.ScaleShape(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += TCollection_AsciiString(theFactor)+")";
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShape("
+    << theObject << ", " << thePoint << ", " << theFactor << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -1078,6 +1042,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
 
   //Compute the scale
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Scale driver failed");
       return NULL;
@@ -1090,15 +1057,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.ScaleShapeCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += TCollection_AsciiString(theFactor)+")";
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform("
+    << theObject << ", " << thePoint << ", " << theFactor << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -1114,30 +1074,34 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
 {
   SetErrorCode(KO);
 
-  if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL;
+  if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
 
   Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
 
-  // Get last functions of the arguments
-  Handle(GEOM_Function) aStartLCS = theStartLCS->GetLastFunction();
-  Handle(GEOM_Function) aEndLCS = theEndLCS->GetLastFunction();
-
   //Add a Position function
+  Standard_Integer aType = POSITION_SHAPE;
+  if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL;
+
   Handle(GEOM_Function) aFunction =
-    theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE);
+    theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
   if (aFunction.IsNull()) return NULL;
 
   //Check if the function is set correctly
   if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
 
+  //Set operation arguments
   GEOMImpl_IPosition aTI (aFunction);
   aTI.SetShape(anOriginal);
-  aTI.SetStartLCS(aStartLCS);
-  aTI.SetEndLCS(aEndLCS);
+  aTI.SetEndLCS(theEndLCS->GetLastFunction());
+  if (!theStartLCS.IsNull())
+    aTI.SetStartLCS(theStartLCS->GetLastFunction());
 
   //Compute the Position
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Position driver failed");
       return NULL;
@@ -1150,15 +1114,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.PositionShape(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry);
-  aDescr += (anEntry+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionShape("
+    << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
 
   SetErrorCode(OK);
   return theObject;
@@ -1174,7 +1131,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
 {
   SetErrorCode(KO);
 
-  if (theObject.IsNull() || theStartLCS.IsNull() || theEndLCS.IsNull()) return NULL;
+  if (theObject.IsNull() || theEndLCS.IsNull()) return NULL;
 
   Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
@@ -1183,8 +1140,11 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
   Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
 
   //Add a position function
+  Standard_Integer aType = POSITION_SHAPE_COPY;
+  if (theStartLCS.IsNull()) aType = POSITION_SHAPE_FROM_GLOBAL_COPY;
+
   Handle(GEOM_Function) aFunction =
-    aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_SHAPE_COPY);
+    aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), aType);
   if (aFunction.IsNull()) return NULL;
 
   //Check if the function is set correctly
@@ -1192,11 +1152,15 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
 
   GEOMImpl_IPosition aTI (aFunction);
   aTI.SetShape(anOriginal);
-  aTI.SetStartLCS(theStartLCS->GetLastFunction());
   aTI.SetEndLCS(theEndLCS->GetLastFunction());
+  if (!theStartLCS.IsNull())
+    aTI.SetStartLCS(theStartLCS->GetLastFunction());
 
   //Compute the position
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Position driver failed");
       return NULL;
@@ -1209,16 +1173,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.PositionShapeCopy(");
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry);
-  aDescr += (anEntry+")");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition("
+    << theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -1258,6 +1214,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Rotate driver failed");
       return NULL;
@@ -1270,14 +1229,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.Rotate(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theAngle)+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject
+    << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
 
   SetErrorCode(OK);
   return theObject;
@@ -1314,6 +1267,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Rotate driver failed");
       return NULL;
@@ -1326,14 +1282,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.RotateCopy(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theAngle)+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject
+    << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
 
   SetErrorCode(OK);
   return aCopy;
@@ -1372,6 +1322,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Rotate driver failed");
       return NULL;
@@ -1384,14 +1337,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.Rotate1D(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes)+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1D("
+    << theObject << ", " << theAxis << ", " << theNbTimes << ")";
 
   SetErrorCode(OK);
   return aCopy;
@@ -1436,6 +1383,71 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object)
 
   //Compute the translation
   try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Rotate driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2D("
+    << theObject << ", " << theAxis << ", " << theAngle << ", "
+      << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
+
+  SetErrorCode(OK);
+  return aCopy;
+}
+
+//=============================================================================
+/*!
+ *  RotateThreePoints
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEOM_Object) theObject,
+                                                                     Handle(GEOM_Object) theCentPoint, 
+                                                                     Handle(GEOM_Object) thePoint1,
+                                                                     Handle(GEOM_Object) thePoint2)
+{
+  SetErrorCode(KO);
+
+  if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
+
+  Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+  if (aLastFunction.IsNull()) return NULL;  //There is no function which creates an object to be rotated
+
+  // Get last functions of the arguments
+  Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
+  Handle(GEOM_Function) aP1F = thePoint1->GetLastFunction();
+  Handle(GEOM_Function) aP2F = thePoint2->GetLastFunction();
+
+
+  //Add a rotate function
+  aFunction = theObject->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS);
+
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+  GEOMImpl_IRotate aRI(aFunction);
+  aRI.SetCentPoint(aCPF);
+  aRI.SetPoint1(aP1F);
+  aRI.SetPoint2(aP2F);
+  aRI.SetOriginal(aLastFunction);
+
+  //Compute the translation
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
     if (!GetSolver()->ComputeFunction(aFunction)) {
       SetErrorCode("Rotate driver failed");
       return NULL;
@@ -1448,18 +1460,67 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object)
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(theObject->GetEntry(), anEntry);
-  aDescr += (anEntry+" = ITransformOperations.Rotate2D(");
-  aDescr += (anEntry+", ");
-  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theAngle)+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes1)+", ");
-  aDescr += (TCollection_AsciiString(theStep)+", ");
-  aDescr += (TCollection_AsciiString(theNbTimes2)+") ");
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.RotateThreePoints(" << theObject
+                              << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
+
+  SetErrorCode(OK);
+  return theObject;
+}
+
+//=============================================================================
+/*!
+ *  RotateThreePointsCopy
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle(GEOM_Object) theObject, 
+                                                        Handle(GEOM_Object) theCentPoint, 
+                                                        Handle(GEOM_Object) thePoint1,
+                                                        Handle(GEOM_Object) thePoint2)
+{
+  SetErrorCode(KO);
+
+  if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
+
+  Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+  if (aLastFunction.IsNull()) return NULL;  //There is no function which creates an object to be rotated
+
+  //Add a new Copy object
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+
+  //Add a rotate function
+  aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
+  if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+  GEOMImpl_IRotate aRI(aFunction);
+  aRI.SetCentPoint(theCentPoint->GetLastFunction());
+  aRI.SetPoint1(thePoint1->GetLastFunction());
+  aRI.SetPoint2(thePoint2->GetLastFunction());
+  aRI.SetOriginal(aLastFunction);
+
+  //Compute the translation
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Rotate driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotationThreePoints(" << theObject
+                              << ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
 
   SetErrorCode(OK);
   return aCopy;
 }
+