]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMImpl/GEOMImpl_ILocalOperations.cxx
Salome HOME
SMH: Merged GEOM (NEWGUI, HEAD, POLYWORK)
[modules/geom.git] / src / GEOMImpl / GEOMImpl_ILocalOperations.cxx
index 5df5db4589968e23d758e4ab8244083b5e15fd3d..031ab0eaf3490a0165e0c2cb92eab72cd1e765a8 100644 (file)
@@ -3,6 +3,8 @@ using namespace std;
 #include "GEOMImpl_ILocalOperations.hxx"
 
 #include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
 #include "GEOMImpl_Types.hxx"
 
 #include "GEOMImpl_FilletDriver.hxx"
@@ -94,14 +96,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
-  aDescr = anEntry + " = ILocalOperations.MakeFilletAll(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theR)+")");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aFillet << " = geompy.MakeFilletAll("
+                               << theShape << ", " << theR << ")";
 
   SetErrorCode(OK);
   return aFillet;
@@ -158,22 +154,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
-  aDescr = anEntry + " = ILocalOperations.MakeFilletEdges(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theR)+", [");
+  GEOM::TPythonDump pd (aFunction);
+  pd << aFillet << " = geompy.MakeFillet(" << theShape
+    << ", " << theR << ", geompy.ShapeType[\"EDGE\"], [";
+
   it = theEdges.begin();
-  aDescr += (TCollection_AsciiString(*it)+", ");
-  it++;
-  for (; it != theEdges.end(); it++) {
-    aDescr += ", ";
-    aDescr += TCollection_AsciiString(*it);
+  pd << (*it++);
+  while (it != theEdges.end()) {
+    pd << ", " << (*it++);
   }
-  aDescr += "])";
-
-  aFunction->SetDescription(aDescr);
+  pd << "])";
 
   SetErrorCode(OK);
   return aFillet;
@@ -230,22 +220,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFaces
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
-  aDescr = anEntry + " = ILocalOperations.MakeFilletFaces(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theR)+", [");
+  GEOM::TPythonDump pd (aFunction);
+  pd << aFillet << " = geompy.MakeFillet(" << theShape
+    << ", " << theR << ", geompy.ShapeType[\"FACE\"], [";
+
   it = theFaces.begin();
-  aDescr += (TCollection_AsciiString(*it)+", ");
-  it++;
-  for (; it != theFaces.end(); it++) {
-    aDescr += ", ";
-    aDescr += TCollection_AsciiString(*it);
+  pd << (*it++);
+  while (it != theFaces.end()) {
+    pd << ", " << (*it++);
   }
-  aDescr += "])";
-
-  aFunction->SetDescription(aDescr);
+  pd << "])";
 
   SetErrorCode(OK);
   return aFillet;
@@ -293,15 +277,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferAll (Handle(GEOM_Objec
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
-  aDescr += anEntry;
-  aDescr += " = ILocalOperations.MakeChamferAll(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theD)+")");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aChamfer << " = geompy.MakeChamferAll("
+                               << theShape << ", " << theD << ")";
 
   SetErrorCode(OK);
   return aChamfer;
@@ -354,18 +331,9 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
-  aDescr += anEntry;
-  aDescr += " = ILocalOperations.MakeChamferEdge(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theD1)+", ");
-  aDescr += (TCollection_AsciiString(theD2)+", ");
-  aDescr += (TCollection_AsciiString(theFace1)+", ");
-  aDescr += (TCollection_AsciiString(theFace2)+")");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aChamfer
+    << " = geompy.MakeChamferEdge(" << theShape << ", " << theD1
+      << ", " << theD2 << ", " << theFace1 << ", " << theFace2 << ")";
 
   SetErrorCode(OK);
   return aChamfer;
@@ -424,24 +392,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
-  aDescr += anEntry;
-  aDescr += " = ILocalOperations.MakeChamferFaces(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theD1)+", ");
-  aDescr += (TCollection_AsciiString(theD2)+", [");
+  GEOM::TPythonDump pd (aFunction);
+  pd << aChamfer << " = geompy.MakeChamferFaces(" << theShape
+    << ", " << theD1 << ", " << theD2 << ", [";
+
   it = theFaces.begin();
-  aDescr += (TCollection_AsciiString(*it)+", ");
-  it++;
-  for (; it != theFaces.end(); it++) {
-    aDescr += ", ";
-    aDescr += TCollection_AsciiString(*it);
+  pd << (*it++);
+  while (it != theFaces.end()) {
+    pd << ", " << (*it++);
   }
-  aDescr += "])";
-
-  aFunction->SetDescription(aDescr);
+  pd << "])";
 
   SetErrorCode(OK);
   return aChamfer;
@@ -493,17 +453,9 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeArchimede (Handle(GEOM_Object
   }
 
   //Make a Python command
-  TCollection_AsciiString anEntry, aDescr("");
-  TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
-  aDescr += anEntry;
-  aDescr += " = ILocalOperations.MakeArchimede(";
-  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
-  aDescr += (anEntry+", ");
-  aDescr += (TCollection_AsciiString(theWeight)+", ");
-  aDescr += (TCollection_AsciiString(theWaterDensity)+", ");
-  aDescr += (TCollection_AsciiString(theMeshingDeflection)+")");
-
-  aFunction->SetDescription(aDescr);
+  GEOM::TPythonDump(aFunction) << aChamfer
+    << " = geompy.Archimede(" << theShape << ", " << theWeight << ", "
+      << theWaterDensity << ", " << theMeshingDeflection << ")";
 
   SetErrorCode(OK);
   return aChamfer;