#include "GEOM_ISubShape.hxx"
#include "GEOM_SubShapeDriver.hxx"
#include "GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx"
+#include "GEOM_PythonDump.hxx"
#include "utilities.h"
-#include <Interface_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
-
#include <TDF_Tool.hxx>
#include <TDF_Data.hxx>
#include <TDF_LabelSequence.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TColStd_ListOfTransient.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
+#include <Interface_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
#include <map>
if(_objects.IsBound(anID)) _objects.UnBind(anID);
_objects.Bind(anID, anObject);
- TCollection_AsciiString aDescr("");
+ GEOM::TPythonDump pd (aFunction);
- if(isStandaloneOperation) {
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(anObject->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geom.AddSubShape(";
- TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (", [");
- for(Standard_Integer i=theIndices->Lower(); i<=theIndices->Upper(); i++) {
- aDescr += (TCollection_AsciiString(theIndices->Value(i))+", ");
+ if (isStandaloneOperation) {
+ pd << anObject << " = geompy.GetSubShape(" << theMainShape << ", [";
+ Standard_Integer i = theIndices->Lower(), up = theIndices->Upper();
+ for (; i <= up - 1; i++) {
+ pd << theIndices->Value(i) << ", ";
}
- aDescr.Trunc(aDescr.Length()-1);
- aDescr += "])";
+ pd << theIndices->Value(up) << "])";
}
- else
- TCollection_AsciiString aDescr("None");
-
- aFunction->SetDescription(aDescr);
+ else
+ pd << "None";
return anObject;
}
if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
- aScript = "import geompy\n\n";
+ aScript = "import geompy\n";
+ aScript += "import math\n\n";
aScript += "def RebuildData(theStudy):";
aScript += "\n\tgeompy.init_geom(theStudy)";
return NULL;
}
+//=======================================================================
+//function : GetAllDumpNames
+//purpose :
+//=======================================================================
+
+Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
+{
+ Handle(TColStd_HSequenceOfAsciiString) aRetSeq = new TColStd_HSequenceOfAsciiString;
+
+ Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString it (_studyEntry2NameMap);
+ for (; it.More(); it.Next()) {
+ aRetSeq->Append(it.Value());
+ }
+
+ return aRetSeq;
+}
+
//===========================================================================
// Internal functions
#define _GEOM_Engine_HXX_
#include "GEOM_Application.hxx"
+#include "GEOM_Object.hxx"
+#include "GEOM_DataMapOfAsciiStringTransient.hxx"
+
#include <Interface_DataMapOfIntegerTransient.hxx>
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
-#include <TDF_Label.hxx>
#include <TDocStd_Document.hxx>
-#include "GEOM_Object.hxx"
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TopAbs.hxx>
-
-#include "GEOM_DataMapOfAsciiStringTransient.hxx"
class GEOM_Engine
{
const char* GetDumpName (const char* theStudyEntry) const;
+ Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const;
+
protected:
static void SetEngine(GEOM_Engine* theEngine);
* SetDescription
*/
//=============================================================================
-void GEOM_Function::SetDescription(TCollection_AsciiString& theDescription)
+void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription)
{
TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL);
- Handle(TDataStd_Comment) aComment = TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription));
+ Handle(TDataStd_Comment) aComment =
+ TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription));
}
//=============================================================================
TCollection_AsciiString GetDescription();
//Sets aPython description of the function
- void SetDescription(TCollection_AsciiString& theDescription);
+ void SetDescription(const TCollection_AsciiString& theDescription);
//Access to arguments
//=============================================================================
TCollection_AsciiString GEOM_Object::GetAuxData()
{
+ TCollection_AsciiString aData;
+
Handle(TDataStd_Comment) aCommentAttr;
- if(!_label.FindAttribute(TDataStd_Comment::GetID(), aCommentAttr)) return NULL;
-
- TCollection_AsciiString aData(aCommentAttr->Get());
- return aData.ToCString();
+ if (_label.FindAttribute(TDataStd_Comment::GetID(), aCommentAttr))
+ aData = aCommentAttr->Get();
+
+ return aData;
}
--- /dev/null
+// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#include "GEOM_PythonDump.hxx"
+
+#include <TDF_Tool.hxx>
+
+namespace GEOM
+{
+ size_t TPythonDump::myCounter = 0;
+
+ TPythonDump::TPythonDump (Handle(GEOM_Function)& theFunction)
+ {
+ myFunction = theFunction;
+ myCounter++;
+ }
+
+ TPythonDump::~TPythonDump()
+ {
+ if (--myCounter == 0) {
+ myFunction->SetDescription((char *)myStream.str().c_str());
+ }
+ }
+
+// TPythonDump::operator TCollection_AsciiString () const
+// {
+// if (myCounter == 1) {
+// return TCollection_AsciiString ((char *)myStream.str().c_str());
+// }
+// return TCollection_AsciiString ();
+// }
+
+ TPythonDump& TPythonDump::operator<< (long int theArg)
+ {
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (int theArg)
+ {
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (double theArg)
+ {
+ myStream.precision(16);
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (float theArg)
+ {
+ myStream.precision(8);
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (const void* theArg)
+ {
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (const char* theArg)
+ {
+ myStream<<theArg;
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<< (const Handle(GEOM_Object)& theObject)
+ {
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ myStream << anEntry.ToCString();
+ return *this;
+ }
+}
--- /dev/null
+// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+#ifndef _GEOM_PYTHONDUMP_HXX_
+#define _GEOM_PYTHONDUMP_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "GEOM_Object.hxx"
+#include "GEOM_Function.hxx"
+
+#include <TCollection_AsciiString.hxx>
+
+namespace GEOM
+{
+ class TPythonDump
+ {
+ std::ostringstream myStream;
+ static size_t myCounter;
+
+ Handle(GEOM_Function) myFunction;
+
+ public:
+ TPythonDump (Handle(GEOM_Function)& theFunction);
+ virtual ~TPythonDump();
+
+// operator TCollection_AsciiString () const;
+
+ TPythonDump& operator<< (long int theArg);
+ TPythonDump& operator<< (int theArg);
+ TPythonDump& operator<< (double theArg);
+ TPythonDump& operator<< (float theArg);
+ TPythonDump& operator<< (const void* theArg);
+ TPythonDump& operator<< (const char* theArg);
+ TPythonDump& operator<< (const Handle(GEOM_Object)& theObject);
+ };
+}
+
+#endif
GEOM_IOperations.cxx \
GEOM_Solver.cxx \
GEOM_SubShapeDriver.cxx \
+ GEOM_PythonDump.cxx \
GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx \
GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx \
GEOM_DataMapOfAsciiStringTransient_0.cxx
GEOM_IOperations.hxx \
GEOM_ISubShape.hxx \
GEOM_Solver.hxx \
+ GEOM_PythonDump.hxx \
GEOM_DataMapOfAsciiStringTransient.hxx \
Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx
#include <TDF_Tool.hxx>
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_BoxDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aBox->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeBoxDXDYDZ(";
- aDescr += (TCollection_AsciiString(theDX)+", ");
- aDescr += (TCollection_AsciiString(theDY)+", ");
- aDescr += (TCollection_AsciiString(theDZ)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxDXDYDZ("
+ << theDX << ", " << theDY << ", " << theDZ << ")";
SetErrorCode(OK);
return aBox;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aBox->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeBoxTwoPnt(";
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxTwoPnt("
+ << thePnt1 << ", " << thePnt2 << ")";
SetErrorCode(OK);
return aBox;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCylinder->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeCylinderRH(";
- aDescr += (TCollection_AsciiString(theR)+", ");
- aDescr += (TCollection_AsciiString(theH)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCylinder
+ << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")";
SetErrorCode(OK);
return aCylinder;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCylinder->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeCylinder(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", ");
- aDescr += (TCollection_AsciiString(theH)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
+ << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
SetErrorCode(OK);
return aCylinder;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCone->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeConeR1R2H(";
- aDescr += (TCollection_AsciiString(theR1)+", ");
- aDescr += (TCollection_AsciiString(theR2)+", ");
- aDescr += (TCollection_AsciiString(theH)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeConeR1R2H("
+ << theR1 << ", " << theR2 << ", " << theH << ")";
SetErrorCode(OK);
return aCone;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCone->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeCone(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR1)+", ");
- aDescr += (TCollection_AsciiString(theR2)+", ");
- aDescr += (TCollection_AsciiString(theH)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeCone(" << thePnt
+ << ", " << theVec << ", " << theR1 << ", " << theR2 << ", " << theH << ")";
SetErrorCode(OK);
return aCone;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSphere->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeSphereR(";
- aDescr += (TCollection_AsciiString(theR)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aSphere << " = geompy.MakeSphereR(" << theR << ")";
SetErrorCode(OK);
return aSphere;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSphere->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeSpherePntR(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aSphere
+ << " = geompy.MakeSpherePntR(" << thePnt << ", " << theR << ")";
SetErrorCode(OK);
return aSphere;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(anEll->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeTorusRR(";
- aDescr += (TCollection_AsciiString(theRMajor)+", ");
- aDescr += (TCollection_AsciiString(theRMinor)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorusRR("
+ << theRMajor << ", " << theRMinor << ")";
SetErrorCode(OK);
return anEll;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(anEll->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeTorus(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theRMajor)+", ");
- aDescr += (TCollection_AsciiString(theRMinor)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorus(" << thePnt
+ << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
SetErrorCode(OK);
return anEll;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aPrism->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakePrismVecH(";
- TDF_Tool::Entry(theBase->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theH)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH("
+ << theBase << ", " << theVec << ", " << theH << ")";
SetErrorCode(OK);
return aPrism;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aPrism->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakePrism(";
- TDF_Tool::Entry(theBase->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) << aPrism << " = geompy.MakePrism("
+ << theBase << ", " << thePoint1 << ", " << thePoint2 << ")";
SetErrorCode(OK);
return aPrism;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPipe->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.MakePipe(");
- TDF_Tool::Entry(theBase->GetEntry(), anEntry);
- aDescr += (anEntry + ", ");
- TDF_Tool::Entry(thePath->GetEntry(), anEntry);
- aDescr += (anEntry + ")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe("
+ << theBase << ", " << thePath << ")";
SetErrorCode(OK);
return aPipe;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("import math\n\t");
- TDF_Tool::Entry(aRevolution->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeRevolution(";
- TDF_Tool::Entry(theBase->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theAngle/PI)+"*math.pi)");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
+ << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
SetErrorCode(OK);
return aRevolution;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSolid->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeSolid(";
- TDF_Tool::Entry(theShell->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")";
SetErrorCode(OK);
return aSolid;
* MakeFilling
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter)
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
+ (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
+ double theTol2D, double theTol3D, int theNbIter)
{
SetErrorCode(KO);
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFilling->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeFilling(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theMinDeg)+", ");
- aDescr += (TCollection_AsciiString(theMaxDeg)+", ");
- aDescr += (TCollection_AsciiString(theTol2D)+", ");
- aDescr += (TCollection_AsciiString(theTol3D)+", ");
- aDescr += (TCollection_AsciiString(theNbIter)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFilling << " = geompy.MakeFilling("
+ << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", "
+ << theTol2D << ", " << theTol3D << ", " << theNbIter << ")";
SetErrorCode(OK);
return aFilling;
#include <TDF_Tool.hxx>
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "GEOMImpl_PointDriver.hxx"
#include "GEOMImpl_VectorDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeVertex(");
- aDescr += (TCollection_AsciiString(theX)+", ");
- aDescr += (TCollection_AsciiString(theY)+", ");
- aDescr += (TCollection_AsciiString(theZ)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertex("
+ << theX << ", " << theY << ", " << theZ << ")";
SetErrorCode(OK);
return aPoint;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeVertexWithRef(");
- TDF_Tool::Entry(theReference->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theX)+", ");
- aDescr += (TCollection_AsciiString(theY)+", ");
- aDescr += (TCollection_AsciiString(theZ)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexWithRef("
+ << theReference << ", " << theX << ", " << theY << ", " << theZ << ")";
SetErrorCode(OK);
return aPoint;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeVertexOnCurve(");
- TDF_Tool::Entry(theCurve->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theParameter)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
+ << theCurve << ", " << theParameter << ")";
SetErrorCode(OK);
return aPoint;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aVector->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeVectorDXDYDZ(");
- aDescr += (TCollection_AsciiString(theDX)+", ");
- aDescr += (TCollection_AsciiString(theDY)+", ");
- aDescr += (TCollection_AsciiString(theDZ)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ("
+ << theDX << ", " << theDY << ", " << theDZ << ")";
SetErrorCode(OK);
return aVector;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aVector->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeVector(");
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector("
+ << thePnt1 << ", " << thePnt2 << ")";
SetErrorCode(OK);
return aVector;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aLine->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeLine(");
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theDir->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine("
+ << thePnt << ", " << theDir << ")";
SetErrorCode(OK);
return aLine;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aLine->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeLineTwoPnt(");
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt("
+ << thePnt1 << ", " << thePnt2 << ")";
SetErrorCode(OK);
return aLine;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakePlaneThreePnt(");
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt3->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += TCollection_AsciiString(theSize) + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")";
SetErrorCode(OK);
return aPlane;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakePlane(");
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += TCollection_AsciiString(theSize) + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane("
+ << thePnt << ", " << theVec << ", " << theSize << ")";
SetErrorCode(OK);
return aPlane;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakePlaneFace(");
- TDF_Tool::Entry(theFace->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += TCollection_AsciiString(theSize) + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace("
+ << theFace << ", " << theSize << ")";
SetErrorCode(OK);
return aPlane;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aMarker->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeMarker(";
- aDescr += TCollection_AsciiString(theOX) + ", ";
- aDescr += TCollection_AsciiString(theOY) + ", ";
- aDescr += TCollection_AsciiString(theOZ) + ", ";
- aDescr += TCollection_AsciiString(theXDX) + ", ";
- aDescr += TCollection_AsciiString(theXDY) + ", ";
- aDescr += TCollection_AsciiString(theXDZ) + ", ";
- aDescr += TCollection_AsciiString(theYDX) + ", ";
- aDescr += TCollection_AsciiString(theYDY) + ", ";
- aDescr += TCollection_AsciiString(theYDZ) + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker("
+ << theOX << ", " << theOY << ", " << theOZ << ", "
+ << theXDX << ", " << theXDY << ", " << theXDZ << ", "
+ << theYDX << ", " << theYDY << ", " << theYDZ << ")";
SetErrorCode(OK);
return aMarker;
#include "GEOMImpl_Block6Explorer.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "GEOMAlgo_GlueAnalyser.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeQuad(";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad("
+ << theEdge1 << ", " << theEdge2 << ", " << theEdge3 << ", " << theEdge4 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeQuad2Edges(";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad2Edges("
+ << theEdge1 << ", " << theEdge2 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeQuad4Vertices(";
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad4Vertices("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << thePnt4 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeHexa(";
- TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace4->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace5->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace6->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa("
+ << theFace1 << ", " << theFace2 << ", " << theFace3 << ")"
+ << theFace4 << ", " << theFace5 << ", " << theFace6 << ")";
SetErrorCode(OK);
return aBlock;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeHexa2Faces(";
- TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa2Faces("
+ << theFace1 << ", " << theFace2 << ")";
SetErrorCode(OK);
return aBlock;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlockComp->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.BlocksOp.MakeBlockCompound(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlockComp
+ << " = geompy.MakeBlockCompound(" << theCompound << ")";
SetErrorCode(OK);
return aBlockComp;
//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
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theX) + ", ";
- aDescr += TCollection_AsciiString(theY) + ", ";
- aDescr += TCollection_AsciiString(theZ) + ", ";
- aDescr += TCollection_AsciiString(theEpsilon) + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ << aResult << " = geompy.GetPoint(" << theShape << ", "
+ << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetEdge() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetEdge(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdge("
+ << theShape << ", " << thePoint1 << ", " << thePoint2 << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetEdgeNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetEdgeNearPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdgeNearPoint("
+ << theShape << ", " << thePoint << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetFaceByPoints() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetFaceByPoints(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByPoints("
+ << theShape << ", " << thePoint1 << ", " << thePoint2
+ << ", " << thePoint3 << ", " << thePoint4 << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetFaceByEdges() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetFaceByEdges(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByEdges("
+ << theShape << ", " << theEdge1 << ", " << theEdge2 << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetOppositeFace() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetOppositeFace(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetOppositeFace("
+ << theShape << ", " << theFace << ")";
SetErrorCode(OK);
return aResult;
(Handle(GEOM_Object) theShape,
Handle(GEOM_Object) thePoint)
{
-// OSD_Timer timer1, timer2, timer3, timer4, timer5;
-// timer1.Start();
-
SetErrorCode(KO);
//New object
Standard_Real PX, PY, PZ;
aPnt.Coord(PX, PY, PZ);
-// timer1.Stop();
-// timer2.Start();
-
// 1. Classify the point relatively each face
Standard_Integer nearest = 2, nbFound = 0;
TopTools_DataMapOfShapeInteger mapShapeDist;
} // if (!mapShapeDist.IsBound(aFace))
}
-// timer2.Stop();
-// timer3.Start();
-
// 2. Define face, containing the point or having minimum distance to it
if (nbFound > 1) {
if (nearest == 0) {
}
} // if (nbFound > 1)
-// timer3.Stop();
-// timer4.Start();
-
if (nbFound == 0) {
SetErrorCode("There are no faces near the given point");
return NULL;
anArray->SetValue(1, anIndices.FindIndex(aShape));
aResult = GetEngine()->AddSubShape(theShape, anArray);
}
-
-// timer4.Stop();
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
return NULL;
}
-// timer5.Start();
-
- //The GetFaceNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetFaceNearPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceNearPoint("
+ << theShape << ", " << thePoint << ")";
SetErrorCode(OK);
-
-// timer5.Stop();
-//
-// cout << "Show current face times:" << endl;
-// timer1.Show();
-// timer2.Show();
-// timer3.Show();
-// timer4.Show();
-// timer5.Show();
-
return aResult;
}
return NULL;
}
- //The GetFaceByNormale() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetFaceByNormale(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theVector->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByNormale("
+ << theShape << ", " << theVector << ")";
SetErrorCode(OK);
return aResult;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.RemoveExtraEdges(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy
+ << " = geompy.RemoveExtraEdges(" << theObject << ")";
SetErrorCode(OK);
return aCopy;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.CheckAndImprove(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy
+ << " = geompy.CheckAndImprove(" << theObject << ")";
SetErrorCode(OK);
return aCopy;
Handle(GEOM_Function) aFunction;
TopTools_MapOfShape mapShape;
- TCollection_AsciiString anAsciiList = "[", anEntry;
+ TCollection_AsciiString anAsciiList, anEntry;
// Map shapes
TopTools_IndexedMapOfShape anIndices;
//Make a Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ anAsciiList += anEntry + ", ";
}
}
}
return aBlocks;
}
- anAsciiList.Trunc(anAsciiList.Length() - 1);
- anAsciiList += "]";
+ anAsciiList.Trunc(anAsciiList.Length() - 2);
//The explode doesn't change object so no new function is required.
aFunction = theCompound->GetLastFunction();
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = geompy.MakeBlockExplode(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theMinNbFaces) + ", ";
- aDescr += TCollection_AsciiString(theMaxNbFaces) + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
+ << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
+ << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
SetErrorCode(OK);
return aBlocks;
return NULL;
}
- //The GetBlockNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theCompound->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetBlockNearPoint(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockNearPoint("
+ << theCompound << ", " << thePoint << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetBlockByParts() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theCompound->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- TCollection_AsciiString aDescr (anEntry);
- aDescr += " = geompy.GetBlockByParts(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", [";
- aDescr += aPartsDescr + "])";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockByParts("
+ << theCompound << ", [" << aPartsDescr.ToCString() << "])";
SetErrorCode(OK);
return aResult;
//Get the parts
Standard_Integer argi, aLen = theParts->Length();
TopTools_Array1OfShape anArgs (1, aLen);
- TCollection_AsciiString anEntry, aPartsDescr, anAsciiList = "[";
+ TCollection_AsciiString anEntry, aPartsDescr, anAsciiList;
+
for (argi = 1; argi <= aLen; argi++) {
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theParts->Value(argi));
Handle(GEOM_Function) aRef = anObj->GetLastFunction();
// For Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- if (argi > 1) aPartsDescr += ", ";
- aPartsDescr += anEntry;
+ aPartsDescr += anEntry + ", ";
}
//Get the Blocks
anObj = GetEngine()->AddSubShape(theCompound, anArray);
aBlocks->Append(anObj);
- //Make a Python command
+ // For Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ anAsciiList += anEntry + ", ";
+ if (aFunction.IsNull())
+ aFunction = anObj->GetLastFunction();
}
}
}
return NULL;
}
- anAsciiList.Trunc(anAsciiList.Length() - 1);
- anAsciiList += "]";
-
- //The GetBlocksByParts() doesn't change object so no new function is required.
- aFunction = theCompound->GetLastFunction();
-
//Make a Python command
- TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = geompy.GetBlocksByParts(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", [";
- aDescr += aPartsDescr + "])";
+ aPartsDescr.Trunc(aPartsDescr.Length() - 2);
+ anAsciiList.Trunc(anAsciiList.Length() - 2);
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetBlocksByParts(" << theCompound
+ << ", [" << aPartsDescr.ToCString() << "])";
SetErrorCode(OK);
return aBlocks;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeMultiTransformation1D(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theDirFace1) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2) + ", ";
- aDescr += TCollection_AsciiString(theNbTimes) + ") ";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation1D("
+ << theObject << ", " << theDirFace1 << ", " << theDirFace2 << ", " << theNbTimes << ")";
SetErrorCode(OK);
return aCopy;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeMultiTransformation2D(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theDirFace1U) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2U) + ", ";
- aDescr += TCollection_AsciiString(theNbTimesU) + ", ";
- aDescr += TCollection_AsciiString(theDirFace1V) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2V) + ", ";
- aDescr += TCollection_AsciiString(theNbTimesV) + ") ";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation2D("
+ << theObject << ", " << theDirFace1U << ", " << theDirFace2U << ", " << theNbTimesU
+ << ", " << theDirFace1V << ", " << theDirFace2V << ", " << theNbTimesV << ")";
SetErrorCode(OK);
return aCopy;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
TopTools_MapOfShape mapAcceptedEdges;
+ TCollection_AsciiString aListRes, anEntry;
for (ie = 1; ie <= nbEdges; ie++) {
TopoDS_Shape curE = MEW.FindKey(ie);
// Add the chain to the result
aSeq->Append(aChain);
+
+ //Make a Python command
+ TDF_Tool::Entry(aChain->GetEntry(), anEntry);
+ aListRes += anEntry + ", ";
}
if (aSeq->IsEmpty()) {
return aSeq;
}
+ aListRes.Trunc(aListRes.Length() - 2);
+
// 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
- TCollection_AsciiString aDescr
- ("\n\tlistPropagationChains = IShapesOperations.Propagate(");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry + ")");
-
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
+ << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
SetErrorCode(OK);
return aSeq;
#include "GEOMImpl_IBooleanOperations.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_BooleanDriver.hxx"
return NULL;
}
- //Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aBool->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeBoolean(";
- TDF_Tool::Entry(theShape1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theShape2->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theOp)+")");
-
- aFunction->SetDescription(aDescr);
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aBool;
+ if (theOp == 1) pd << " = geompy.MakeCommon(";
+ else if (theOp == 2) pd << " = geompy.MakeCut(";
+ else if (theOp == 3) pd << " = geompy.MakeFuse(";
+ else if (theOp == 4) pd << " = geompy.MakeSection(";
+ else {}
+ pd << theShape1 << ", " << theShape2 << ")";
SetErrorCode(OK);
return aBool;
}
//Make a Python command
- TCollection_AsciiString aDescr;
- TDF_Tool::Entry(aPartition->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakePartition([";
- // Shapes
- aDescr += aShapesDescr + "], [";
- // Tools
- aDescr += aToolsDescr + "], [";
- // Keep Ins
- aDescr += aKeepInsDescr + "], [";
- // Remove Ins
- aDescr += aRemoveInsDescr + "], ";
- // Limit
- aDescr += TCollection_AsciiString(theLimit) + ", ";
- // Remove Webs
- if (theRemoveWebs) aDescr += "1, [";
- else aDescr += "0, [";
+ GEOM::TPythonDump pd (aFunction);
+ pd << aPartition << " = geompy.MakePartition([";
+ // Shapes, Tools
+ pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], [";
+ // Keep Ins, Remove Ins
+ pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], ";
+ // Limit, Remove Webs
+ pd << theLimit << ", " << (int)theRemoveWebs << ", [";
// Materials
if (theMaterials->Length() > 0) {
int i = theMaterials->Lower();
- aDescr += TCollection_AsciiString(theMaterials->Value(i));
+ pd << theMaterials->Value(i);
i++;
for (; i <= theMaterials->Upper(); i++) {
- aDescr += ", ";
- aDescr += TCollection_AsciiString(theMaterials->Value(i));
+ pd << ", " << theMaterials->Value(i);
}
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aPartition;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aPart->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeHalfPartition(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aPart << " = geompy.MakeHalfPartition("
+ << theShape << ", " << thePlane << ")";
SetErrorCode(OK);
return aPart;
#include "GEOMImpl_ICurvesOperations.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_PolylineDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aPolyline->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakePolyline([";
+ GEOM::TPythonDump pd (aFunction);
+ pd << aPolyline << " = geompy.MakePolyline([";
+
it = thePoints.begin();
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
- it++;
- for (; it != thePoints.end(); it++) {
- aDescr += ", ";
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
+ pd << (*it++);
+ while (it != thePoints.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aPolyline;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCircle->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeCircleThreePnt(";
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt3->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
SetErrorCode(OK);
return aCircle;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aCircle->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeCircle(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle("
+ << thePnt << ", " << theVec << ", " << theR << ")";
SetErrorCode(OK);
return aCircle;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(anEll->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeEllipse(";
- TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(theVec->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theRMajor)+", ");
- aDescr += (TCollection_AsciiString(theRMinor)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
+ << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
SetErrorCode(OK);
return anEll;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(anArc->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeArc(";
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt3->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
SetErrorCode(OK);
return anArc;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSpline->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeBezier([";
+ GEOM::TPythonDump pd (aFunction);
+ pd << aSpline << " = geompy.MakeBezier([";
+
it = thePoints.begin();
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
- it++;
- for (; it != thePoints.end(); it++) {
- aDescr += ", ";
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
+ pd << (*it++);
+ while (it != thePoints.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aSpline;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSpline->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeInterpol([";
+ GEOM::TPythonDump pd (aFunction);
+ pd << aSpline << " = geompy.MakeInterpol([";
+
it = thePoints.begin();
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
- it++;
- for (; it != thePoints.end(); it++) {
- aDescr += ", ";
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
+ pd << (*it++);
+ while (it != thePoints.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aSpline;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aSketcher->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeSketcher( \"";
- aDescr += aCommand+"\", [";
+ GEOM::TPythonDump pd (aFunction);
+ pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand << "\", [";
it = theWorkingPlane.begin();
- aDescr += TCollection_AsciiString(*it);
- it++;
- for (; it != theWorkingPlane.end(); it++) {
- aDescr += ", ";
- aDescr += TCollection_AsciiString(*it);
+ pd << (*it++);
+ while (it != theWorkingPlane.end()) {
+ pd << ", " << (*it++);
}
-
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aSketcher;
#include "GEOM_Function.hxx"
#include "GEOM_ISubShape.hxx"
+#include "GEOM_PythonDump.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
* CreateGroup
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup(Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
+ (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
{
SetErrorCode(KO);
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, -1);
- //Add a new Fillet object
+ //Add a new Fillet object
Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theMainShape, anArray);
//Set a GROUP type
//Set a sub shape type
TDF_Label aFreeLabel = aGroup->GetFreeLabel();
TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType);
-
- //Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
- aDescr = anEntry + " = geompy.CreateGroup(";
- TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString((int)theShapeType)+")");
+ //Make a Python command
Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
- aFunction->SetDescription(aDescr);
+ //TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+
+ //GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup
+ GEOM::TPythonDump(aFunction) << aGroup
+ << " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")";
SetErrorCode(OK);
return aGroup;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("geompy.AddObject( ");
- TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theSubShapeID)+" )");
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- aDescr = aFunction->GetDescription() + "\n\t" + aDescr;
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ << "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
return;
* RemoveObject
*/
//=============================================================================
-void GEOMImpl_IGroupOperations::RemoveObject(Handle(GEOM_Object) theGroup, int theSubShapeID)
+void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int theSubShapeID)
{
SetErrorCode(KO);
if(theGroup.IsNull()) return;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("geompy.RemoveObject( ");
- TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theSubShapeID)+" )");
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ << "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
return;
}
aSSI.SetIndices(aNewSeq);
+ }
- //Make a Python command
- TCollection_AsciiString anEntry, aDescr("geompy.UnionList( ");
- TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
- for (i = 1; i <= aLen; i++) {
- Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
- TDF_Tool::Entry(anObj_i->GetEntry(), anEntry);
- aDescr += anEntry + (char*)(( i < aLen ) ? ", " : " ])");
- }
-
- aFunction->SetDescription(aDescr);
+ //Make a Python command
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+
+ GEOM::TPythonDump pd (aFunction);
+ pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", [";
+
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
+ pd << anObj_i << (( i < aLen ) ? ", " : "])");
}
SetErrorCode(OK);
}
aSSI.SetIndices(aNewSeq);
+ }
+ //Make a Python command
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- //Make a Python command
- TCollection_AsciiString anEntry, aDescr("geompy.DifferenceList( ");
- TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
- for (i = 1; i <= aLen; i++) {
- Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
- TDF_Tool::Entry(anObj_i->GetEntry(), anEntry);
- aDescr += anEntry + (char*)(( i < aLen ) ? ", " : " ])");;
- }
+ GEOM::TPythonDump pd (aFunction);
+ pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", [";
- aFunction->SetDescription(aDescr);
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
+ pd << anObj_i << (( i < aLen ) ? ", " : "])");
}
SetErrorCode(OK);
* GetMainShape
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape(Handle(GEOM_Object) theGroup)
+Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object) theGroup)
{
SetErrorCode(KO);
if(theGroup.IsNull()) return NULL;
- Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
- if(aFunction.IsNull()) return NULL;
-
- GEOM_ISubShape aSSI(aFunction);
- aFunction = aSSI.GetMainShape();
- if(aFunction.IsNull()) return NULL;
+ Handle(GEOM_Function) aGroupFunction = theGroup->GetFunction(1);
+ if (aGroupFunction.IsNull()) return NULL;
+
+ GEOM_ISubShape aSSI (aGroupFunction);
+ Handle(GEOM_Function) aMainShapeFunction = aSSI.GetMainShape();
+ if (aMainShapeFunction.IsNull()) return NULL;
- TDF_Label aLabel = aFunction->GetOwnerEntry();
+ TDF_Label aLabel = aMainShapeFunction->GetOwnerEntry();
Handle(GEOM_Object) aMainShape = GEOM_Object::GetObject(aLabel);
- if(aMainShape.IsNull()) return NULL;
-
+ if (aMainShape.IsNull()) return NULL;
+
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aMainShape->GetEntry(), aDescr);
- aDescr += " = geompy.GetMainShape( ";
- TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
- aDescr += (anEntry+" )");
-
- aFunction = theGroup->GetFunction(1);
- aDescr = aFunction->GetDescription() + "\n\t" + aDescr;
- aFunction->SetDescription(aDescr);
+ TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription();
+
+ GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t"
+ << aMainShape << " = geompy.GetMainShape(" << theGroup << ")";
SetErrorCode(OK);
return aMainShape;
#include "GEOMImpl_IHealingOperations.hxx"
+#include "GEOM_PythonDump.hxx"
+
#include "GEOMImpl_HealingDriver.hxx"
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_IHealing.hxx"
return NULL;
}
- //Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.ProcessShape( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aNewObject << " = geompy.ProcessShape(" << theObject << ", [";
+
// list of operators
int i = theOperators->Lower(), nb = theOperators->Upper();
for ( ; i <= nb; i++) {
- aDescr += "\"";
- aDescr += theOperators->Value( i );
- aDescr += "\"";
- aDescr += (char*)(( i < nb ) ? ", " : " ], [ ");
+ pd << "\"" << TCollection_AsciiString(theOperators->Value( i )).ToCString()
+ << (( i < nb ) ? "\", " : "\"");
}
+ pd << "], [";
// list of parameters
i = theParams->Lower(); nb = theParams->Upper();
for ( ; i <= nb; i++) {
- aDescr += "\"";
- aDescr += TCollection_AsciiString(theParams->Value( i ));
- aDescr += "\"";
- aDescr += (char*)(( i < nb ) ? ", " : " ], [ ");
+ pd << "\"" << TCollection_AsciiString(theParams->Value( i )).ToCString()
+ << (( i < nb ) ? "\", " : "\"");
}
+ pd << "], [";
// list of values
i = theValues->Lower(); nb = theValues->Upper();
- for ( ; i <= nb; i++)
- aDescr += TCollection_AsciiString(theValues->Value( i ))
- + (char*)(( i < nb ) ? ", " : " ])");
-
- aFunction->SetDescription(aDescr);
+ for ( ; i <= nb; i++) {
+ pd << "\"" << TCollection_AsciiString(theValues->Value( i )).ToCString()
+ << (( i < nb ) ? "\", " : "\"");
+ }
+ pd << "])";
SetErrorCode(OK);
return aNewObject;
* SuppressFaces
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces (Handle(GEOM_Object) theObject,
- const Handle(TColStd_HArray1OfInteger)& theFaces)
+Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces
+ (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theFaces)
{
// set error code, check parameters
SetErrorCode(KO);
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.SuppressFaces( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aNewObject << " = geompy.SuppressFaces(" << theObject << ", [";
+
// list of face ids
int i = theFaces->Lower(), nb = theFaces->Upper();
for ( ; i <= nb; i++)
- aDescr +=
- TCollection_AsciiString(theFaces->Value( i ))
- + (char*)(( i < nb ) ? ", " : " ])");
-
- aFunction->SetDescription(aDescr);
+ pd << theFaces->Value( i ) << (( i < nb ) ? ", " : "])");
SetErrorCode(OK);
return aNewObject;
* CloseContour
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour (Handle(GEOM_Object) theObject,
- const Handle(TColStd_HArray1OfInteger)& theWires,
- bool isCommonVertex)
+Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour
+ (Handle(GEOM_Object) theObject,
+ const Handle(TColStd_HArray1OfInteger)& theWires,
+ bool isCommonVertex)
{
// set error code, check parameters
SetErrorCode(KO);
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.CloseContour( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aNewObject << " = geompy.CloseContour(" << theObject << ", [";
+
// list of wire ids
int i = theWires->Lower(), nb = theWires->Upper();
for ( ; i <= nb; i++)
- aDescr += TCollection_AsciiString(theWires->Value( i ))
- + (char*)(( i < nb ) ? ", " : " ], ");
- aDescr += (char*)( isCommonVertex ? "1 )" : "0 )" );
+ pd << theWires->Value( i ) << (( i < nb ) ? ", " : "], ");
- aFunction->SetDescription(aDescr);
+ pd << (int)isCommonVertex << ")";
SetErrorCode(OK);
return aNewObject;
* RemoveIntWires
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires (Handle(GEOM_Object) theObject,
- const Handle(TColStd_HArray1OfInteger)& theWires)
+Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires
+ (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theWires)
{
// set error code, check parameters
SetErrorCode(KO);
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.SuppressInternalWires( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
- // list of wire ids
- int i = theWires->Lower(), nb = theWires->Upper();
- for ( ; i <= nb; i++)
- aDescr += TCollection_AsciiString(theWires->Value( i ))
- + (char*)(( i < nb ) ? ", " : " ])");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aNewObject << " = geompy.SuppressInternalWires(" << theObject << ", [";
- aFunction->SetDescription(aDescr);
+ // list of wire ids
+ if (!theWires.IsNull()) {
+ int i = theWires->Lower(), nb = theWires->Upper();
+ for ( ; i <= nb; i++)
+ pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])");
+ } else {
+ pd << "])";
+ }
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.SuppressHoles( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+", [ ");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aNewObject << " = geompy.SuppressHoles(" << theObject << ", [";
+
// list of wire ids
int i = theWires->Lower(), nb = theWires->Upper();
for ( ; i <= nb; i++)
- aDescr += TCollection_AsciiString(theWires->Value( i ))
- + (char*)(( i < nb ) ? ", " : " ])");
-
- aFunction->SetDescription(aDescr);
+ pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])");
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.Sew( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry+", " + theTolerance + " )";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.Sew("
+ << theObject << ", " << theTolerance << ")";
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
- aDescr += " = geompy.DivideEdge( ";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ", " + theIndex + ", " + theValue + ", ";
- aDescr += (char*)( isByParameter ? "1 )" : "0 )" );
+ GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.DivideEdge(" << theObject
+ << ", " << theIndex << ", " << theValue << ", " << (int)isByParameter << ")";
SetErrorCode(OK);
return aNewObject;
theOpen->Append(anObj);
}
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+
+ Standard_Integer i, aLen = theClosed->Length();
+ if (aLen > 0) {
+ pd << "(isDone, [";
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theClosed->Value(i));
+ pd << anObj_i << ((i < aLen) ? ", " : "");
+ }
+ pd << "], ";
+ } else {
+ pd << "(isDone, empty_list, ";
+ }
+
+ aLen = theOpen->Length();
+ if (aLen > 0) {
+ pd << "[";
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theOpen->Value(i));
+ pd << anObj_i << ((i < aLen) ? ", " : "");
+ }
+ pd << "]";
+ } else {
+ pd << "empty_list";
+ }
+
+ pd << ") = geompy.GetFreeBoundary(" << theObject << ")";
+
SetErrorCode(OK);
return true;
}
#include <TDF_Tool.hxx>
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "GEOMImpl_CopyDriver.hxx"
#include "GEOMImpl_ExportDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeCopy(");
- TDF_Tool::Entry(theOriginal->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeCopy(" << theOriginal << ")";
SetErrorCode(OK);
return aCopy;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- aDescr = "geompy.Export(";
- TDF_Tool::Entry(theOriginal->GetEntry(), anEntry);
- aDescr += (anEntry + ", \"");
- aDescr += (TCollection_AsciiString(aFileName) + "\", \"");
- aDescr += (TCollection_AsciiString(aFormatName) + "\")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal
+ << ", \"" << theFileName << "\", \"" << theFormatName << "\")";
SetErrorCode(OK);
}
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(result->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.Import(\"");
- aDescr += (TCollection_AsciiString(aFileName) + "\", \"");
- aDescr += (TCollection_AsciiString(aFormatName) + "\")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\""
+ << theFileName << "\", \"" << theFormatName << "\")";
SetErrorCode(OK);
return result;
#include "GEOMImpl_ILocalOperations.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_FilletDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = geompy.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = geompy.MakeFillet(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"EDGE\"], [");
+ 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = geompy.MakeFillet(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"FACE\"], [");
+ 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.Archimede(";
- 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;
#include "GEOMImpl_IMeasure.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCDG->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.MakeCDG(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCDG << " = geompy.MakeCDG(" << theShape << ")";
SetErrorCode(OK);
return aCDG;
#include "GEOMImpl_Block6Explorer.hxx"
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "GEOMAlgo_FinderShapeOn.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(anEdge->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeEdge(");
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdge("
+ << thePnt1 << ", " << thePnt2 << ")";
SetErrorCode(OK);
return anEdge;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeFace(";
- TDF_Tool::Entry(theWire->GetEntry(), anEntry);
- aDescr += anEntry;
- if (isPlanarWanted)
- aDescr += ", 1)";
- else
- aDescr += ", 0)";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace("
+ << theWire << ", " << (int)isPlanarWanted << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aShape->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.MakeFaceWires([");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aShape << " = geompy.MakeFaceWires([";
+
// Shapes
it = theShapes.begin();
if (it != theShapes.end()) {
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
- it++;
- for (; it != theShapes.end(); it++) {
- aDescr += ", ";
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
+ pd << (*it++);
+ while (it != theShapes.end()) {
+ pd << ", " << (*it++);
}
}
- if (isPlanarWanted)
- aDescr += "], 1)";
-
- else
- aDescr += "], 0)";
-
- aFunction->SetDescription(aDescr);
+ pd << "], " << (int)isPlanarWanted << ")";
SetErrorCode(OK);
return aShape;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aSolid->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeSolid(";
- TDF_Tool::Entry(theShell->GetEntry(), anEntry);
- aDescr += (anEntry+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aSolid
+ << " = geompy.MakeSolid(" << theShell << ")";
SetErrorCode(OK);
return aSolid;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aShape->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.");
- aDescr += (theMethodName + "([");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aShape << " = geompy." << theMethodName.ToCString() << "([";
+
// Shapes
it = theShapes.begin();
if (it != theShapes.end()) {
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
- it++;
- for (; it != theShapes.end(); it++) {
- aDescr += ", ";
- TDF_Tool::Entry((*it)->GetEntry(), anEntry);
- aDescr += anEntry;
+ pd << (*it++);
+ while (it != theShapes.end()) {
+ pd << ", " << (*it++);
}
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aShape;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aGlued->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.MakeGlueFaces(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theTolerance) + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueFaces("
+ << theShape << ", " << theTolerance << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
const Standard_Integer theShapeType,
const Standard_Boolean isSorted)
{
-// OSD_Timer timer1, timer2, timer3, timer4;
-// timer1.Start();
-
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
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;
TopTools_ListIteratorOfListOfShape itSub (listShape);
- TCollection_AsciiString anAsciiList = "[", anEntry;
+ TCollection_AsciiString anAsciiList, anEntry;
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
TopoDS_Shape aValue = itSub.Value();
anArray = new TColStd_HArray1OfInteger(1,1);
anObj = GetEngine()->AddSubShape(theShape, anArray);
aSeq->Append(anObj);
+ // for python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
anAsciiList += anEntry;
anAsciiList += ",";
}
-// timer3.Stop();
-// timer4.Start();
-
+ //Make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1);
- anAsciiList += "]";
- anAsciiList = TCollection_AsciiString("\n\t") + anAsciiList;
-
- //The explode doesn't change object so no new function is requiered.
aFunction = theShape->GetLastFunction();
-
- //Make a Python command
- TCollection_AsciiString aDescr(anAsciiList);
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- if (isSorted)
- aDescr += " = geompy.SubShapeAllSorted( ";
- else
- aDescr += " = geompy.SubShapeAll( ";
- aDescr += (anEntry + ", ");
- aDescr += theShapeType;
- aDescr += " )";
-
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
-
- 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();
+ GEOM::TPythonDump pd (aFunction);
+ pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString();
+ pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
+ pd << theShape << ", " << theShapeType << ")";
+ SetErrorCode(OK);
return aSeq;
}
aSeq->Append(anIndices.FindIndex(aValue));
}
- //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
- TCollection_AsciiString aDescr
- ("\n\tlistSubShapeAllIDs = geompy.SubShapeAllIDs(");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry + ",");
- if (isSorted)
- aDescr += (TCollection_AsciiString(theShapeType) + ", 1)");
- else
- aDescr += (TCollection_AsciiString(theShapeType) + ", 0)");
-
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ GEOM::TPythonDump pd (aFunction);
+ pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll";
+ pd << (isSorted ? "SortedIDs(" : "IDs(");
+ pd << theShape << ", " << theShapeType << ")";
SetErrorCode(OK);
return aSeq;
return NULL;
}
- //The GetSubShape() doesn't change object so no new function is requiered.
- Handle(GEOM_Function) aFunction = theMainShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
//Make a Python command
- TCollection_AsciiString aDescr ("\n\t");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- aDescr += anEntry + " = geompy.GetSubShape(";
- TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
- aDescr += anEntry + ", [" + theID + "])";
-
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ GEOM::TPythonDump(aFunction) << anObj << " = geompy.GetSubShape("
+ << theMainShape << ", [" << theID << "])";
SetErrorCode(OK);
return anObj;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aReversed->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.ChangeOrientation(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aReversed
+ << " = geompy.ChangeOrientation(" << theShape << ")";
SetErrorCode(OK);
return aReversed;
//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
- TCollection_AsciiString aDescr ("\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry + ")");
-
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString()
+ << "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
SetErrorCode(OK);
return aSeq;
Handle(GEOM_Object) anObj;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ TCollection_AsciiString anAsciiList, anEntry;
TopTools_MapOfShape mapShape2;
TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType));
anArray->SetValue(1, anIndices.FindIndex(aSS));
anObj = GetEngine()->AddSubShape(theShape1, anArray);
aSeq->Append(anObj);
+
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
}
}
return aSeq;
}
- //The explode doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape1->GetLastFunction();
-
//Make a Python command
- TCollection_AsciiString aDescr
- ("\n\tlistSharedShapes = geompy.GetSharedShapes(");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theShape1->GetEntry(), anEntry);
- aDescr += (anEntry + ",");
- TDF_Tool::Entry(theShape2->GetEntry(), anEntry);
- aDescr += (anEntry + ",");
- aDescr += TCollection_AsciiString(theShapeType) + ")";
+ anAsciiList.Trunc(anAsciiList.Length() - 1);
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetSharedShapes(" << theShape1 << ", "
+ << theShape2 << ", " << theShapeType << ")";
SetErrorCode(OK);
return aSeq;
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+static GEOM::TPythonDump& operator<< (GEOM::TPythonDump& theDump,
+ const GEOMAlgo_State theState)
+{
+ switch (theState) {
+ case GEOMAlgo_ST_IN:
+ theDump << "geompy.GEOM.ST_IN";
+ break;
+ case GEOMAlgo_ST_OUT:
+ theDump << "geompy.GEOM.ST_OUT";
+ break;
+ case GEOMAlgo_ST_ON:
+ theDump << "geompy.GEOM.ST_ON";
+ break;
+ case GEOMAlgo_ST_ONIN:
+ theDump << "geompy.GEOM.ST_ONIN";
+ break;
+ case GEOMAlgo_ST_ONOUT:
+ theDump << "geompy.GEOM.ST_ONOUT";
+ break;
+ default:
+ theDump << "geompy.GEOM.ST_UNKNOWN";
+ break;
+ }
+ return theDump;
+}
+
//=============================================================================
/*!
* GetShapesOnPlane
Handle(GEOM_Object) anObj;
Handle(TColStd_HArray1OfInteger) anArray;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ TCollection_AsciiString anAsciiList, anEntry;
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
anArray->SetValue(1, id);
anObj = GetEngine()->AddSubShape(theShape, anArray);
aSeq->Append(anObj);
+
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
}
- // The GetShapesOnPlane() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-
// Make a Python command
- TCollection_AsciiString anEntry, aDescr
- ("\n\tlistShapesOnPlane = geompy.GetShapesOnPlane(");
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
- TDF_Tool::Entry(theAx1->GetEntry(), anEntry);
- aDescr += anEntry + ",";
- aDescr += TCollection_AsciiString(theState) + ")";
+ anAsciiList.Trunc(anAsciiList.Length() - 1);
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr += aDescr;
- aFunction->SetDescription(anOldDescr);
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnPlane(" << theShape << ", "
+ << theShapeType << ", " << theAx1 << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
Handle(GEOM_Object) anObj;
Handle(TColStd_HArray1OfInteger) anArray;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ TCollection_AsciiString anAsciiList, anEntry;
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
anArray->SetValue(1, id);
anObj = GetEngine()->AddSubShape(theShape, anArray);
aSeq->Append(anObj);
+
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
}
- // The GetShapesOnCylinder() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-
// Make a Python command
- TCollection_AsciiString anEntry, aDescr
- ("\n\tlistShapesOnCylinder = geompy.GetShapesOnCylinder(");
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
- TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
- aDescr += anEntry + ",";
- aDescr += TCollection_AsciiString(theRadius) + ",";
- aDescr += TCollection_AsciiString(theState) + ")";
+ anAsciiList.Trunc(anAsciiList.Length() - 1);
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr += aDescr;
- aFunction->SetDescription(anOldDescr);
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType
+ << ", " << theAxis << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
Handle(GEOM_Object) anObj;
Handle(TColStd_HArray1OfInteger) anArray;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ TCollection_AsciiString anAsciiList, anEntry;
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
anArray->SetValue(1, id);
anObj = GetEngine()->AddSubShape(theShape, anArray);
aSeq->Append(anObj);
+
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
}
- // The GetShapesOnSphere() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-
// Make a Python command
- TCollection_AsciiString anEntry, aDescr
- ("\n\tlistShapesOnSphere = geompy.GetShapesOnSphere(");
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
- TDF_Tool::Entry(theCenter->GetEntry(), anEntry);
- aDescr += anEntry + ",";
- aDescr += TCollection_AsciiString(theRadius) + ",";
- aDescr += TCollection_AsciiString(theState) + ")";
+ anAsciiList.Trunc(anAsciiList.Length() - 1);
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr += aDescr;
- aFunction->SetDescription(anOldDescr);
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType
+ << ", " << theCenter << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geompy.GetInPlace(";
- TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
- aDescr += anEntry + ",";
- TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
Handle(GEOM_Function) aFunction = aResult->GetFunction(1);
- aFunction->SetDescription(aDescr);
+
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace("
+ << theShapeWhere << ", " << theShapeWhat << ")";
SetErrorCode(OK);
return aResult;
#include <TDF_Tool.hxx>
#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
#include "GEOMImpl_TranslateDriver.hxx"
#include "GEOMImpl_MirrorDriver.hxx"
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.TranslateDXDYDZ(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeTranslationTwoPoints(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeTranslation(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeTranslationVector(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeMultiTranslation1D(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeMultiTranslation2D(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.MakeMirrorByPlane(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.MakeMirrorByPoint(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = geompy.MakeMirrorByAxis(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.OffsetShape(");
- aDescr += (anEntry+", ");
- aDescr += TCollection_AsciiString(theOffset)+")";
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.OffsetShape("
+ << theObject << ", " << theOffset << ")";
SetErrorCode(OK);
return theObject;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeOffset(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakeScaleTransform(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MakePosition(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.TrsfOp.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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), aDescr);
- aDescr += " = geompy.MakeRotation(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MultiRotate1D(");
- 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;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = geompy.MultiRotate2D(");
- 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) << aCopy << " = geompy.MultiRotate2D("
+ << theObject << ", " << theAxis << ", " << theAngle << ", "
+ << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
SetErrorCode(OK);
return aCopy;