From 705488d6da5598ee7d7eff324ac849fa22536277 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 17 Mar 2005 08:00:04 +0000 Subject: [PATCH] Dump Python --- src/GEOM/GEOM_Engine.cxx | 201 ++++++++++++++++-- src/GEOM/GEOM_Engine.hxx | 13 +- src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx | 32 +-- src/GEOMImpl/GEOMImpl_IBasicOperations.cxx | 22 +- src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx | 80 +++---- src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx | 6 +- src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx | 24 +-- src/GEOMImpl/GEOMImpl_IGroupOperations.cxx | 52 ++++- src/GEOMImpl/GEOMImpl_IHealingOperations.cxx | 109 ++++++++-- src/GEOMImpl/GEOMImpl_IInsertOperations.cxx | 16 +- src/GEOMImpl/GEOMImpl_ILocalOperations.cxx | 24 +-- src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx | 2 +- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 55 +++-- .../GEOMImpl_ITransformOperations.cxx | 49 ++--- src/GEOM_I/GEOM_DumpPython.cc | 55 +++++ src/GEOM_I/GEOM_Gen_i.hh | 4 + src/GEOM_I/Makefile.in | 3 +- 17 files changed, 560 insertions(+), 187 deletions(-) create mode 100644 src/GEOM_I/GEOM_DumpPython.cc diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 46726dcea..e945d9853 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -23,6 +24,11 @@ #include #include #include +#include +#include +#include +#include +#include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -50,6 +56,12 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID) return aDocID.IntegerValue(); } +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed); + +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); + //============================================================================= /*! * GetEngine @@ -157,7 +169,9 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) * AddSubShape */ //============================================================================= -Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices) +Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation) { if(theMainShape.IsNull() || theIndices.IsNull()) return NULL; @@ -192,18 +206,25 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, H if(_objects.IsBound(anID)) _objects.UnBind(anID); _objects.Bind(anID, anObject); - TCollection_AsciiString anEntry, aDescr(""); - 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))+", "); + TCollection_AsciiString aDescr(""); + + 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))+", "); + } + aDescr.Trunc(aDescr.Length()-1); + aDescr += "])"; } - aDescr.Trunc(aDescr.Length()-1); - aDescr += "])"; + else + TCollection_AsciiString aDescr("None"); + aFunction->SetDescription(aDescr); return anObject; @@ -222,6 +243,14 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) TCollection_AsciiString anID = BuildIDFromObject(theObject); if(_objects.IsBound(anID)) _objects.UnBind(anID); + int nb = theObject->GetNbFunctions(); + Handle(TDataStd_TreeNode) aNode; + for(int i = 1; i<=nb; i++) { + Handle(GEOM_Function) aFunction = theObject->GetFunction(i); + if(aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) + aNode->Remove(); + } + TDF_Label aLabel = theObject->GetEntry(); aLabel.ForgetAllAttributes(Standard_True); @@ -273,7 +302,9 @@ bool GEOM_Engine::Save(int theDocID, char* theFileName) bool GEOM_Engine::Load(int theDocID, char* theFileName) { Handle(TDocStd_Document) aDoc; - if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) return false; + if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) { + return false; + } aDoc->SetUndoLimit(_UndoLimit); @@ -282,6 +313,8 @@ bool GEOM_Engine::Load(int theDocID, char* theFileName) TDataStd_Integer::Set(aDoc->Main(), theDocID); + _OCAFApp->SaveAs(aDoc, "/dn05/salome/srn/Test.sdg"); + return true; } @@ -310,3 +343,145 @@ void GEOM_Engine::Close(int theDocID) aDoc.Nullify(); } } + +//============================================================================= +/*! + * DumpPython + */ +//============================================================================= +TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript) +{ + TCollection_AsciiString aScript; + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + + if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); + + aScript = "import geompy\n\n"; + aScript += "def RebuildData(theStudy):"; + + Handle(TDataStd_TreeNode) aNode, aRoot; + Handle(GEOM_Function) aFunction; + TColStd_MapOfTransient aMap; + + if(aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { + TDataStd_ChildNodeIterator Itr(aRoot); + for(; Itr.More(); Itr.Next()) { + aNode = Itr.Value(); + aFunction = GEOM_Function::GetFunction(aNode->Label()); + if(aFunction.IsNull()) { + cout << "Null function !!!!" << endl; + continue; + } + ProcessFunction(aFunction, aScript, aMap); + } + } + + aScript += "\n\tpass\n"; + aValidScript = true; + + + Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript); + Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length(); + Resource_DataMapOfAsciiStringAsciiString aNames; + + //Replace entries by the names + TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"); + if(aLen == 0) anUpdatedScript = aScript; + + for(Standard_Integer i = 1; i <= aLen; i+=2) { + anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1); + anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1)); + if(theObjectNames.IsBound(anEntry)) { + aName = theObjectNames.Find(anEntry); + } + else { + aName = aBaseName + TCollection_AsciiString(++objectCounter); + while(theObjectNames.IsBound(aName)) aName = aBaseName + TCollection_AsciiString(++objectCounter); + } + + anUpdatedScript += aName; + aNames.Bind(aName, "1"); + aStart = aSeq->Value(i+1) + 1; + } + + //Add final part of the script + if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); + + return anUpdatedScript; +} + + +//=========================================================================== +// Internal functions +//=========================================================================== +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed) +{ + if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return; + +/* + TDF_LabelSequence aSeq; + theFunction->GetDependency(aSeq); + Standard_Integer aLen = aSeq.Length(); + for(Standard_Integer i = 1; i<= aLen; i++) { + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i)); + if(aFunction.IsNull()) continue; + ProcessFunction(aFunction, theScript, theProcessed); + } +*/ + + TCollection_AsciiString aDescr = theFunction->GetDescription(); + if(aDescr.Length() == 0) { + //cout << "Warning: the function has no description" << endl; + return; + } + //Check if its internal function which doesn't requires dumping + if(aDescr == "None") return; + + theScript += "\n\t"; + theScript += aDescr; + + theProcessed.Add(theFunction); + return; +} + +//============================================================================= +/*! + * FindEntries: Returns a sequence of start/end positions of entries in the string + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString) +{ + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + Standard_Integer aLen = theString.Length(); + Standard_Boolean isFound = Standard_False; + + char* arr = theString.ToCString(); + Standard_Integer i = 0, j; + + while(i < aLen) { + int c = (int)arr[i]; + j = i+1; + if(c >= 48 && c <= 57) { //Is digit? + + isFound = Standard_False; + while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry + c = (int)arr[j++]; + if(c == 58) isFound = Standard_True; + } + + if(isFound) { + aSeq->Append(i+1); // +1 because AsciiString starts from 1 + aSeq->Append(j-1); + } + } + + i = j; + } + + return aSeq; +} diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 3db976f6e..2d7df0999 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -4,10 +4,12 @@ #include "GEOM_Application.hxx" #include +#include #include #include #include "GEOM_Object.hxx" #include +#include #include #include "GEOM_DataMapOfAsciiStringTransient.hxx" @@ -58,8 +60,15 @@ class GEOM_Engine void Redo(int theDocID); //Adds a new sub shape object of the MainShape object - Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices); - + Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation = false); + + TCollection_AsciiString DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript); + protected: static void SetEngine(GEOM_Engine* theEngine); diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 56eb0762b..f6d6b26e2 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -102,7 +102,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, dou TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aBox->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeBoxDXDYDZ("; + aDescr += " = geompy.MakeBoxDXDYDZ("; aDescr += (TCollection_AsciiString(theDX)+", "); aDescr += (TCollection_AsciiString(theDY)+", "); aDescr += (TCollection_AsciiString(theDZ)+")"); @@ -163,7 +163,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aBox->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeBoxTwoPnt("; + aDescr += " = geompy.MakeBoxTwoPnt("; TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -217,7 +217,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCylinder->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeCylinderRH("; + aDescr += " = geompy.MakeCylinderRH("; aDescr += (TCollection_AsciiString(theR)+", "); aDescr += (TCollection_AsciiString(theH)+")"); @@ -281,7 +281,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCylinder->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeCylinderPntVecRH("; + aDescr += " = geompy.MakeCylinder("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -340,7 +340,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, dou TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCone->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeConeR1R2H("; + aDescr += " = geompy.MakeConeR1R2H("; aDescr += (TCollection_AsciiString(theR1)+", "); aDescr += (TCollection_AsciiString(theR2)+", "); aDescr += (TCollection_AsciiString(theH)+")"); @@ -407,7 +407,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCone->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeConePntVecR1R2H("; + aDescr += " = geompy.MakeCone("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -463,7 +463,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR) TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSphere->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSphereR("; + aDescr += " = geompy.MakeSphereR("; aDescr += (TCollection_AsciiString(theR)+")"); aFunction->SetDescription(aDescr); @@ -521,7 +521,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Obje TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSphere->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSpherePntR("; + aDescr += " = geompy.MakeSpherePntR("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theR)+")"); @@ -576,7 +576,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(anEll->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeTorusRR("; + aDescr += " = geompy.MakeTorusRR("; aDescr += (TCollection_AsciiString(theRMajor)+", "); aDescr += (TCollection_AsciiString(theRMinor)+")"); @@ -639,7 +639,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(anEll->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeTorusPntVecRR("; + aDescr += " = geompy.MakeTorus("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -706,7 +706,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aPrism->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakePrismVecH("; + aDescr += " = geompy.MakePrismVecH("; TDF_Tool::Entry(theBase->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -772,7 +772,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aPrism->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakePrismVecH("; + aDescr += " = geompy.MakePrism("; TDF_Tool::Entry(theBase->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); @@ -836,7 +836,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) th //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPipe->GetEntry(), anEntry); - aDescr += (anEntry + " = I3DPrimOperations.MakePipe("); + aDescr += (anEntry + " = geompy.MakePipe("); TDF_Tool::Entry(theBase->GetEntry(), anEntry); aDescr += (anEntry + ", "); TDF_Tool::Entry(thePath->GetEntry(), anEntry); @@ -901,7 +901,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aRevolution->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeRevolutionAxisAngle("; + aDescr += " = geompy.MakeRevolution("; TDF_Tool::Entry(theBase->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); @@ -962,7 +962,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSolid->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSolidShell("; + aDescr += " = geompy.MakeSolid("; TDF_Tool::Entry(theShell->GetEntry(), anEntry); aDescr += (anEntry+")"); @@ -1023,7 +1023,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aFilling->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeFilling("; + aDescr += " = geompy.MakeFilling("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theMinDeg)+", "); diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index a0225ef9c..e74f671e3 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -94,7 +94,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointXYZ("); + aDescr += (anEntry+" = geompy.MakeVertex("); aDescr += (TCollection_AsciiString(theX)+", "); aDescr += (TCollection_AsciiString(theY)+", "); aDescr += (TCollection_AsciiString(theZ)+")"); @@ -152,7 +152,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointReference("); + aDescr += (anEntry+" = geompy.MakeVertexWithRef("); TDF_Tool::Entry(theReference->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theX)+", "); @@ -210,7 +210,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointReference("); + aDescr += (anEntry+" = geompy.MakeVertexOnCurve("); TDF_Tool::Entry(theCurve->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theParameter)+")"); @@ -265,7 +265,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aVector->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeVectorDXDYDZ("); + aDescr += (anEntry+" = geompy.MakeVectorDXDYDZ("); aDescr += (TCollection_AsciiString(theDX)+", "); aDescr += (TCollection_AsciiString(theDY)+", "); aDescr += (TCollection_AsciiString(theDZ)+")"); @@ -323,7 +323,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aVector->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeVectorTwoPnt("); + aDescr += (anEntry+" = geompy.MakeVector("); TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -383,7 +383,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aLine->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeLine("); + aDescr += (anEntry+" = geompy.MakeLine("); TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theDir->GetEntry(), anEntry); @@ -442,7 +442,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aLine->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeLineTwoPnt("); + aDescr += (anEntry+" = geompy.MakeLineTwoPnt("); TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -506,7 +506,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlaneThreePnt("); + aDescr += (anEntry+" = geompy.MakePlaneThreePnt("); TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -570,7 +570,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlanePntVec("); + aDescr += (anEntry+" = geompy.MakePlane("); TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -629,7 +629,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlaneFace("); + aDescr += (anEntry+" = geompy.MakePlaneFace("); TDF_Tool::Entry(theFace->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += TCollection_AsciiString(theSize) + ")"; @@ -686,7 +686,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aMarker->GetEntry(), anEntry); - aDescr += anEntry + " = IBasicOperations.MakeMarker("; + aDescr += anEntry + " = geompy.MakeMarker("; aDescr += TCollection_AsciiString(theOX) + ", "; aDescr += TCollection_AsciiString(theOY) + ", "; aDescr += TCollection_AsciiString(theOZ) + ", "; diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 1f433c622..7d668aa47 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -151,7 +151,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad("; + aDescr += anEntry + " = geompy.MakeQuad("; TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); @@ -217,7 +217,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad2Edges //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad2Edges("; + aDescr += anEntry + " = geompy.MakeQuad2Edges("; TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); @@ -286,7 +286,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad4Vertices //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad4Vertices("; + aDescr += anEntry + " = geompy.MakeQuad4Vertices("; TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -366,7 +366,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aBlock->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeHexa("; + aDescr += anEntry + " = geompy.MakeHexa("; TDF_Tool::Entry(theFace1->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(theFace2->GetEntry(), anEntry); @@ -436,7 +436,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa2Faces //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aBlock->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeHexa2Faces("; + aDescr += anEntry + " = geompy.MakeHexa2Faces("; TDF_Tool::Entry(theFace1->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(theFace2->GetEntry(), anEntry); @@ -496,7 +496,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeBlockCompound //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aBlockComp->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeBlockCompound("; + aDescr += anEntry + " = geompy.BlocksOp.MakeBlockCompound("; TDF_Tool::Entry(theCompound->GetEntry(), anEntry); aDescr += anEntry + ")"; @@ -578,7 +578,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetPoint("; + aDescr += anEntry + " = geompy.GetPoint("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ", "; aDescr += TCollection_AsciiString(theX) + ", "; @@ -586,7 +586,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint aDescr += TCollection_AsciiString(theZ) + ", "; aDescr += TCollection_AsciiString(theEpsilon) + ")"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -702,7 +702,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdge //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetEdge("; + aDescr += anEntry + " = geompy.GetEdge("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); @@ -710,7 +710,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdge TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); aDescr += anEntry + ")"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -832,13 +832,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdgeNearPoint //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetEdgeNearPoint("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -988,7 +988,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByPoints //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByPoints("; + aDescr += anEntry + " = geompy.GetFaceByPoints("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); @@ -1000,7 +1000,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByPoints TDF_Tool::Entry(thePoint4->GetEntry(), anEntry); aDescr += anEntry + ")"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -1131,7 +1131,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByEdges //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByEdges("; + aDescr += anEntry + " = geompy.GetFaceByEdges("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ", "; TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); @@ -1139,7 +1139,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByEdges TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); aDescr += anEntry + ")"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -1210,13 +1210,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetOppositeFace //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetOppositeFace("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -1431,13 +1431,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceNearPoint("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -1584,13 +1584,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByNormale("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -2226,19 +2226,19 @@ TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors switch (errStruct.error) { case NOT_BLOCK: - aDescr += "\nNot a Blocks: "; + aDescr += "\n\tNot a Blocks: "; break; case EXTRA_EDGE: - aDescr += "\nHexahedral solids with degenerated and/or seam edges: "; + aDescr += "\n\tHexahedral solids with degenerated and/or seam edges: "; break; case INVALID_CONNECTION: - aDescr += "\nInvalid connection between two blocks: "; + aDescr += "\n\tInvalid connection between two blocks: "; break; case NOT_CONNECTED: - aDescr += "\nBlocks, not connected with main body: "; + aDescr += "\n\tBlocks, not connected with main body: "; break; case NOT_GLUED: - aDescr += "\nNot glued blocks: "; + aDescr += "\n\tNot glued blocks: "; break; default: break; @@ -2485,7 +2485,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.RemoveExtraEdges("; + aDescr += anEntry + " = geompy.RemoveExtraEdges("; TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += anEntry + ")"; @@ -2539,7 +2539,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::CheckAndImprove //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.CheckAndImprove("; + aDescr += anEntry + " = geompy.CheckAndImprove("; TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += anEntry + ")"; @@ -2626,13 +2626,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound //Make a Python command TCollection_AsciiString aDescr (anAsciiList); - aDescr += " = IBlocksOperations.ExplodeCompoundOfBlocks("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -2811,13 +2811,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockNearPoint //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetBlockNearPoint("; + 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"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -2935,12 +2935,12 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockByParts //Make a Python command TDF_Tool::Entry(aResult->GetEntry(), anEntry); TCollection_AsciiString aDescr (anEntry); - aDescr += " = IBlocksOperations.GetBlockByParts("; + aDescr += " = geompy.GetBlockByParts("; TDF_Tool::Entry(theCompound->GetEntry(), anEntry); aDescr += anEntry + ", ["; aDescr += aPartsDescr + "])"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -3070,12 +3070,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart //Make a Python command TCollection_AsciiString aDescr (anAsciiList); - aDescr += " = IBlocksOperations.GetBlocksByParts("; + aDescr += " = geompy.GetBlocksByParts("; TDF_Tool::Entry(theCompound->GetEntry(), anEntry); aDescr += anEntry + ", ["; aDescr += aPartsDescr + "])"; - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; + TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t"; aNewDescr += aDescr; aFunction->SetDescription(aNewDescr); @@ -3133,7 +3133,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation1D //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation1D("; + aDescr += anEntry + " = geompy.MakeMultiTransformation1D("; TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += anEntry + ", "; aDescr += TCollection_AsciiString(theDirFace1) + ", "; @@ -3202,7 +3202,7 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation2D //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation2D("; + aDescr += anEntry + " = geompy.MakeMultiTransformation2D("; TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += anEntry + ", "; aDescr += TCollection_AsciiString(theDirFace1U) + ", "; @@ -3341,7 +3341,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate // Make a Python command TCollection_AsciiString aDescr - ("\nlistPropagationChains = IShapesOperations.Propagate("); + ("\n\tlistPropagationChains = IShapesOperations.Propagate("); TCollection_AsciiString anEntry; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry + ")"); diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index ad6fba6f4..804763dc8 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -99,7 +99,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aBool->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IBooleanOperations.MakeBoolean("; + aDescr += " = geompy.MakeBoolean("; TDF_Tool::Entry(theShape1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theShape2->GetEntry(), anEntry); @@ -256,7 +256,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition TCollection_AsciiString aDescr; TDF_Tool::Entry(aPartition->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IBooleanOperations.MakePartition(["; + aDescr += " = geompy.MakePartition(["; // Shapes aDescr += aShapesDescr + "], ["; // Tools @@ -338,7 +338,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aPart->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IBooleanOperations.MakePartition("; + aDescr += " = geompy.MakeHalfPartition("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePlane->GetEntry(), anEntry); diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 2bf1dfc6e..afc3f812d 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -100,11 +100,11 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (listGetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakePolyline(["; + aDescr += " = geompy.MakePolyline(["; it = thePoints.begin(); TDF_Tool::Entry((*it)->GetEntry(), anEntry); + aDescr += anEntry; it++; - aDescr += (anEntry+", "); for (; it != thePoints.end(); it++) { aDescr += ", "; TDF_Tool::Entry((*it)->GetEntry(), anEntry); @@ -171,7 +171,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_ TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCircle->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeCircleThreePnt("; + aDescr += " = geompy.MakeCircleThreePnt("; TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -236,7 +236,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aCircle->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeCirclePntVecR("; + aDescr += " = geompy.MakeCircle("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -302,7 +302,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(anEll->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeEllipse("; + aDescr += " = geompy.MakeEllipse("; TDF_Tool::Entry(thePnt->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVec->GetEntry(), anEntry); @@ -369,7 +369,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(anArc->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeArc("; + aDescr += " = geompy.MakeArc("; TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -436,11 +436,11 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSpline->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSplineBezier(["; + aDescr += " = geompy.MakeBezier(["; it = thePoints.begin(); TDF_Tool::Entry((*it)->GetEntry(), anEntry); + aDescr += anEntry; it++; - aDescr += (anEntry+", "); for (; it != thePoints.end(); it++) { aDescr += ", "; TDF_Tool::Entry((*it)->GetEntry(), anEntry); @@ -507,11 +507,11 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSpline->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSplineInterpolation(["; + aDescr += " = geompy.MakeInterpol(["; it = thePoints.begin(); TDF_Tool::Entry((*it)->GetEntry(), anEntry); + aDescr += anEntry; it++; - aDescr += (anEntry+", "); for (; it != thePoints.end(); it++) { aDescr += ", "; TDF_Tool::Entry((*it)->GetEntry(), anEntry); @@ -576,8 +576,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aSketcher->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSketcher("; - aDescr += aCommand+", ["; + aDescr += " = geompy.MakeSketcher( \""; + aDescr += aCommand+"\", ["; it = theWorkingPlane.begin(); aDescr += TCollection_AsciiString(*it); diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx index f4bedb504..2b6d52d59 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -74,7 +74,7 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup(Handle(GEOM_Object) t //Make a Python command TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aGroup->GetEntry(), anEntry); - aDescr = anEntry + " = IGroupOperations.CreateGroup("; + aDescr = anEntry + " = geompy.CreateGroup("; TDF_Tool::Entry(theMainShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString((int)theShapeType)+")"); @@ -119,6 +119,14 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anEntry, aDescr("geompy.AddObject( "); + TDF_Tool::Entry(theGroup->GetEntry(), anEntry); + aDescr += (anEntry+", "); + aDescr += (TCollection_AsciiString(theSubShapeID)+" )"); + + aFunction->SetDescription(aDescr); + SetErrorCode(OK); return; } @@ -179,6 +187,14 @@ void GEOMImpl_IGroupOperations::RemoveObject(Handle(GEOM_Object) theGroup, int t aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anEntry, aDescr("geompy.RemoveObject( "); + TDF_Tool::Entry(theGroup->GetEntry(), anEntry); + aDescr += (anEntry+", "); + aDescr += (TCollection_AsciiString(theSubShapeID)+" )"); + + aFunction->SetDescription(aDescr); + SetErrorCode(OK); return; } @@ -313,6 +329,18 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, } 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); } SetErrorCode(OK); @@ -452,6 +480,19 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, } aSSI.SetIndices(aNewSeq); + + + //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 ) ? ", " : " ])");; + } + + aFunction->SetDescription(aDescr); } SetErrorCode(OK); @@ -496,6 +537,15 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape(Handle(GEOM_Object) Handle(GEOM_Object) aMainShape = GEOM_Object::GetObject(aLabel); if(aMainShape.IsNull()) return NULL; + //Make a Python command + TCollection_AsciiString anEntry, aDescr; + TDF_Tool::Entry(aMainShape->GetEntry(), aDescr); + TDF_Tool::Entry(theGroup->GetEntry(), anEntry); + aDescr += " = geompy.GetMainShape( "; + aDescr += (anEntry+" )"); + + theGroup->GetFunction(1)->SetDescription(aDescr); + SetErrorCode(OK); return aMainShape; } diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx index 774ef28e2..1619695fc 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -22,6 +22,8 @@ using namespace std; #include #include +#include + #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -122,9 +124,35 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ShapeProcess (Handle(GEOM_Objec return NULL; } - //Make a Python command - // ... - // ... missing ... + //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+", [ "); + // list of operators + int i = theOperators->Lower(), nb = theOperators->Upper(); + for ( ; i <= nb; i++) { + aDescr += "\""; + aDescr += theOperators->Value( i ); + aDescr += "\""; + aDescr += (char*)(( i < nb ) ? ", " : " ], [ "); + } + // 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 ) ? ", " : " ], [ "); + } + // 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); SetErrorCode(OK); return aNewObject; @@ -308,8 +336,19 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces (Handle(GEOM_Obje } //Make a Python command - // ... - // ... missing ... + TCollection_AsciiString anEntry, aDescr; + TDF_Tool::Entry(aNewObject->GetEntry(), aDescr); + aDescr += " = geompy.SuppressFaces( "; + TDF_Tool::Entry(theObject->GetEntry(), anEntry); + aDescr += (anEntry+", [ "); + // 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); SetErrorCode(OK); return aNewObject; @@ -368,8 +407,19 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour (Handle(GEOM_Objec } //Make a Python command - // ... - // ... missing ... + TCollection_AsciiString anEntry, aDescr; + TDF_Tool::Entry(aNewObject->GetEntry(), aDescr); + aDescr += " = geompy.CloseContour( "; + 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 ) ? ", " : " ], "); + aDescr += (char*)( isCommonVertex ? "1 )" : "0 )" ); + + aFunction->SetDescription(aDescr); SetErrorCode(OK); return aNewObject; @@ -425,8 +475,18 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires (Handle(GEOM_Obj } //Make a Python command - // ... - // ... missing ... + 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 ) ? ", " : " ])"); + + aFunction->SetDescription(aDescr); SetErrorCode(OK); return aNewObject; @@ -482,8 +542,18 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object) } //Make a Python command - // ... - // ... missing ... + TCollection_AsciiString anEntry, aDescr; + TDF_Tool::Entry(aNewObject->GetEntry(), aDescr); + aDescr += " = geompy.SuppressHoles( "; + 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 ) ? ", " : " ])"); + + aFunction->SetDescription(aDescr); SetErrorCode(OK); return aNewObject; @@ -539,8 +609,13 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj } //Make a Python command - // ... - // ... missing ... + 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); SetErrorCode(OK); return aNewObject; @@ -600,8 +675,12 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::DivideEdge (Handle(GEOM_Object) } //Make a Python command - // ... - // ... missing ... + 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 )" ); SetErrorCode(OK); return aNewObject; diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index 520eba58f..0def67b5a 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -92,7 +92,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) the //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = IInsertOperations.MakeCopy("); + aDescr += (anEntry+" = geompy.MakeCopy("); TDF_Tool::Entry(theOriginal->GetEntry(), anEntry); aDescr += (anEntry+")"); @@ -155,11 +155,11 @@ void GEOMImpl_IInsertOperations::Export //Make a Python command TCollection_AsciiString anEntry, aDescr; - aDescr = "IInsertOperations.Export("; + aDescr = "geompy.Export("; TDF_Tool::Entry(theOriginal->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - aDescr += (TCollection_AsciiString(aFileName) + ", "); - aDescr += (TCollection_AsciiString(aFormatName) + ")"); + aDescr += (anEntry + ", \""); + aDescr += (TCollection_AsciiString(aFileName) + "\", \""); + aDescr += (TCollection_AsciiString(aFormatName) + "\")"); aFunction->SetDescription(aDescr); @@ -218,9 +218,9 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(result->GetEntry(), anEntry); - aDescr += (anEntry + " = IInsertOperations.Import("); - aDescr += (TCollection_AsciiString(aFileName) + ", "); - aDescr += (TCollection_AsciiString(aFormatName) + ")"); + aDescr += (anEntry + " = geompy.Import(\""); + aDescr += (TCollection_AsciiString(aFileName) + "\", \""); + aDescr += (TCollection_AsciiString(aFormatName) + "\")"); aFunction->SetDescription(aDescr); diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 5df5db458..1350771a6 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -96,7 +96,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll //Make a Python command TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletAll("; + aDescr = anEntry + " = geompy.MakeFilletAll("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theR)+")"); @@ -160,12 +160,12 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges //Make a Python command TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletEdges("; + aDescr = anEntry + " = geompy.MakeFillet("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+", ["); + aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"EDGE\"], ["); it = theEdges.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); + aDescr += TCollection_AsciiString(*it); it++; for (; it != theEdges.end(); it++) { aDescr += ", "; @@ -232,12 +232,12 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFaces //Make a Python command TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletFaces("; + aDescr = anEntry + " = geompy.MakeFillet("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+", ["); + aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"FACE\"], ["); it = theFaces.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); + aDescr += TCollection_AsciiString(*it); it++; for (; it != theFaces.end(); it++) { aDescr += ", "; @@ -296,7 +296,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferAll (Handle(GEOM_Objec TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferAll("; + aDescr += " = geompy.MakeChamferAll("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theD)+")"); @@ -357,7 +357,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferEdge("; + aDescr += " = geompy.MakeChamferEdge("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theD1)+", "); @@ -427,13 +427,13 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferFaces("; + aDescr += " = geompy.MakeChamferFaces("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theD1)+", "); aDescr += (TCollection_AsciiString(theD2)+", ["); it = theFaces.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); + aDescr += TCollection_AsciiString(*it); it++; for (; it != theFaces.end(); it++) { aDescr += ", "; @@ -496,7 +496,7 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeArchimede (Handle(GEOM_Object TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = ILocalOperations.MakeArchimede("; + aDescr += " = geompy.Archimede("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theWeight)+", "); diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index c6c4f1c00..064fb0b72 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -112,7 +112,7 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCDG->GetEntry(), anEntry); - aDescr += anEntry + " = IMeasureOperations.MakeCentreOfMass("; + aDescr += anEntry + " = geompy.MakeCDG("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ")"; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index bbe4f5803..d89912123 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -141,7 +141,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(anEdge->GetEntry(), anEntry); - aDescr += (anEntry+" = IShapesOperations.MakeEdge("); + aDescr += (anEntry+" = geompy.MakeEdge("); TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); @@ -213,12 +213,11 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aFace->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IShapesOperations.MakeFace("; + aDescr += " = geompy.MakeFace("; TDF_Tool::Entry(theWire->GetEntry(), anEntry); aDescr += anEntry; if (isPlanarWanted) aDescr += ", 1)"; - else aDescr += ", 0)"; @@ -284,13 +283,13 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aShape->GetEntry(), anEntry); - aDescr += (anEntry + " = IShapesOperations.MakeFaceWires(["); + aDescr += (anEntry + " = geompy.MakeFaceWires(["); // Shapes it = theShapes.begin(); if (it != theShapes.end()) { TDF_Tool::Entry((*it)->GetEntry(), anEntry); + aDescr += anEntry; it++; - aDescr += (anEntry+", "); for (; it != theShapes.end(); it++) { aDescr += ", "; TDF_Tool::Entry((*it)->GetEntry(), anEntry); @@ -328,7 +327,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShell Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShells (list theShapes) { - return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolidShells"); + return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolid"); } //============================================================================= @@ -378,7 +377,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShell (Handle(GEOM_Obje TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aSolid->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IShapesOperations.MakeSolidShell("; + aDescr += " = geompy.MakeSolid("; TDF_Tool::Entry(theShell->GetEntry(), anEntry); aDescr += (anEntry+")"); @@ -455,14 +454,14 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape //Make a Python command TCollection_AsciiString anEntry, aDescr(""); TDF_Tool::Entry(aShape->GetEntry(), anEntry); - aDescr += (anEntry + " = IShapesOperations."); + aDescr += (anEntry + " = geompy."); aDescr += (theMethodName + "(["); // Shapes it = theShapes.begin(); if (it != theShapes.end()) { TDF_Tool::Entry((*it)->GetEntry(), anEntry); + aDescr += anEntry; it++; - aDescr += (anEntry+", "); for (; it != theShapes.end(); it++) { aDescr += ", "; TDF_Tool::Entry((*it)->GetEntry(), anEntry); @@ -532,7 +531,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aGlued->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IShapesOperations.MakeGlueFaces("; + aDescr += " = geompy.MakeGlueFaces("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ", "; aDescr += TCollection_AsciiString(theTolerance) + ")"; @@ -627,7 +626,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode anAsciiList.Trunc(anAsciiList.Length() - 1); anAsciiList += "]"; - anAsciiList = TCollection_AsciiString("\n") + anAsciiList; + anAsciiList = TCollection_AsciiString("\n\t") + anAsciiList; //The explode doesn't change object so no new function is requiered. aFunction = theShape->GetLastFunction(); @@ -635,12 +634,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode //Make a Python command TCollection_AsciiString aDescr(anAsciiList); TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += " = IShapesOperations.MakeExplode("; - aDescr += (anEntry + ","); if (isSorted) - aDescr += (TCollection_AsciiString(theShapeType) + ", 1)"); + aDescr += " = geompy.SubShapeAllSorted( "; else - aDescr += (TCollection_AsciiString(theShapeType) + ", 0)"); + aDescr += " = geompy.SubShapeAll( "; + aDescr += (anEntry + ", "); + aDescr += theShapeType; + aDescr += " )"; TCollection_AsciiString anOldDescr = aFunction->GetDescription(); anOldDescr = anOldDescr + aDescr; @@ -725,7 +725,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs //Make a Python command TCollection_AsciiString aDescr - ("\nlistSubShapeAllIDs = IShapesOperations.SubShapeAllIDs("); + ("\n\tlistSubShapeAllIDs = geompy.SubShapeAllIDs("); TCollection_AsciiString anEntry; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry + ","); @@ -757,7 +757,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetSubShape Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); anArray->SetValue(1, theID); - Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray); + Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray,true); if (anObj.IsNull()) { SetErrorCode("Can not get a sub-shape with the given ID"); return NULL; @@ -767,13 +767,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetSubShape Handle(GEOM_Function) aFunction = theMainShape->GetLastFunction(); //Make a Python command - TCollection_AsciiString aDescr ("\n"); + TCollection_AsciiString aDescr ("\n\t"); TCollection_AsciiString anEntry; TDF_Tool::Entry(anObj->GetEntry(), anEntry); - aDescr += anEntry + " = IShapesOperations.GetSubShape("; + aDescr += anEntry + " = geompy.GetSubShape("; TDF_Tool::Entry(theMainShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theID) + ")"; + aDescr += anEntry + ", [" + theID + "])"; TCollection_AsciiString anOldDescr = aFunction->GetDescription(); anOldDescr = anOldDescr + aDescr; @@ -882,7 +881,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aReversed->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IShapesOperations.ReverseShape("; + aDescr += " = geompy.ChangeOrientation("; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + ")"; @@ -934,7 +933,7 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetFreeFacesIDs Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); //Make a Python command - TCollection_AsciiString aDescr ("\nlistFreeFacesIDs = IShapesOperations.GetFreeFacesIDs("); + TCollection_AsciiString aDescr ("\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs("); TCollection_AsciiString anEntry; TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += (anEntry + ")"); @@ -998,7 +997,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes //Make a Python command TCollection_AsciiString aDescr - ("\nlistSharedShapes = IShapesOperations.GetSharedShapes("); + ("\n\tlistSharedShapes = geompy.GetSharedShapes("); TCollection_AsciiString anEntry; TDF_Tool::Entry(theShape1->GetEntry(), anEntry); aDescr += (anEntry + ","); @@ -1118,7 +1117,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan // Make a Python command TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnPlane = IShapesOperations.GetShapesOnPlane("); + ("\n\tlistShapesOnPlane = geompy.GetShapesOnPlane("); TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; TDF_Tool::Entry(theAx1->GetEntry(), anEntry); @@ -1243,7 +1242,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli // Make a Python command TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnCylinder = IShapesOperations.GetShapesOnCylinder("); + ("\n\tlistShapesOnCylinder = geompy.GetShapesOnCylinder("); TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; TDF_Tool::Entry(theAxis->GetEntry(), anEntry); @@ -1354,7 +1353,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe // Make a Python command TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnSphere = IShapesOperations.GetShapesOnSphere("); + ("\n\tlistShapesOnSphere = geompy.GetShapesOnSphere("); TDF_Tool::Entry(theShape->GetEntry(), anEntry); aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; TDF_Tool::Entry(theCenter->GetEntry(), anEntry); @@ -1485,7 +1484,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aResult->GetEntry(), anEntry); aDescr += anEntry; - aDescr += " = IShapesOperations.GetInPlace("; + aDescr += " = geompy.GetInPlace("; TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry); aDescr += anEntry + ","; TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry); diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index d7e2397c0..b288a54c4 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -103,7 +103,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateTwoPoints("); + aDescr += (anEntry+" = geompy.TrsfOp.TranslateTwoPoints("); aDescr += (anEntry+", "); TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -160,7 +160,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZ("); + aDescr += (anEntry+" = geompy.TrsfOp.TranslateDXDYDZ("); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theX)+", "); aDescr += (TCollection_AsciiString(theY)+", "); @@ -219,7 +219,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateTwoPointsCopy("); + aDescr += (anEntry+" = geompy.MakeTranslationTwoPoints("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); @@ -279,7 +279,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZCopy("); + aDescr += (anEntry+" = geompy.MakeTranslation("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += (TCollection_AsciiString(theX)+", "); @@ -338,7 +338,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateVector("); + aDescr += (anEntry+" = geompy.TrsfOp.TranslateVector("); aDescr += (anEntry+", "); TDF_Tool::Entry(theVector->GetEntry(), anEntry); aDescr += (anEntry+") "); @@ -394,7 +394,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateVectorCopy("); + aDescr += (anEntry+" = geompy.MakeTranslationVector("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVector->GetEntry(), anEntry); @@ -453,7 +453,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Translate1D("); + aDescr += (anEntry+" = geompy.MakeMultiTranslation1D("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVector->GetEntry(), anEntry); @@ -522,7 +522,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Translate2D("); + aDescr += (anEntry+" = geompy.MakeMultiTranslation2D("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theVector->GetEntry(), anEntry); @@ -587,7 +587,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPlane("); + aDescr += (anEntry + " = geompy.TrsfOp.MirrorPlane("); aDescr += (anEntry + ", "); TDF_Tool::Entry(thePlane->GetEntry(), anEntry); aDescr += (anEntry + ") "); @@ -642,7 +642,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPlaneCopy("); + aDescr += (anEntry + " = geompy.MakeMirrorByPlane("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry + ", "); TDF_Tool::Entry(thePlane->GetEntry(), anEntry); @@ -699,7 +699,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPoint("); + aDescr += (anEntry + " = geompy.TrsfOp.MirrorPoint("); aDescr += (anEntry + ", "); TDF_Tool::Entry(thePoint->GetEntry(), anEntry); aDescr += (anEntry + ") "); @@ -754,7 +754,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPointCopy("); + aDescr += (anEntry + " = geompy.MakeMirrorByPoint("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry + ", "); TDF_Tool::Entry(thePoint->GetEntry(), anEntry); @@ -811,7 +811,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorAxis("); + aDescr += (anEntry + " = geompy.TrsfOp.MirrorAxis("); aDescr += (anEntry + ", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); aDescr += (anEntry + ") "); @@ -866,7 +866,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorAxisCopy("); + aDescr += (anEntry + " = geompy.MakeMirrorByAxis("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry + ", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); @@ -921,7 +921,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.OffsetShape("); + aDescr += (anEntry+" = geompy.TrsfOp.OffsetShape("); aDescr += (anEntry+", "); aDescr += TCollection_AsciiString(theOffset)+")"; aFunction->SetDescription(aDescr); @@ -976,7 +976,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.OffsetShapeCopy("); + aDescr += (anEntry+" = geompy.MakeOffset("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); aDescr += TCollection_AsciiString(theOffset)+")"; @@ -1034,7 +1034,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.ScaleShape("); + aDescr += (anEntry+" = geompy.TrsfOp.ScaleShape("); aDescr += (anEntry+", "); TDF_Tool::Entry(thePoint->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -1092,7 +1092,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.ScaleShapeCopy("); + aDescr += (anEntry+" = geompy.MakeScaleTransform("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(thePoint->GetEntry(), anEntry); @@ -1152,7 +1152,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.PositionShape("); + aDescr += (anEntry+" = geompy.TrsfOp.PositionShape("); aDescr += (anEntry+", "); TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -1211,7 +1211,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.PositionShapeCopy("); + aDescr += (anEntry+" = geompy.MakePosition("); TDF_Tool::Entry(theObject->GetEntry(), anEntry); aDescr += (anEntry+", "); TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry); @@ -1272,7 +1272,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate("); + aDescr += (anEntry+" = geompy.TrsfOp.Rotate("); aDescr += (anEntry+", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -1327,8 +1327,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec //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+" = ITransformOperations.RotateCopy("); aDescr += (anEntry+", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -1386,7 +1387,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate1D("); + aDescr += (anEntry+" = geompy.MultiRotate1D("); aDescr += (anEntry+", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); aDescr += (anEntry+", "); @@ -1450,7 +1451,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) //Make a Python command TCollection_AsciiString anEntry, aDescr; TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate2D("); + aDescr += (anEntry+" = geompy.MultiRotate2D("); aDescr += (anEntry+", "); TDF_Tool::Entry(theAxis->GetEntry(), anEntry); aDescr += (anEntry+", "); diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc new file mode 100644 index 000000000..0ac10afeb --- /dev/null +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -0,0 +1,55 @@ +using namespace std; + +#include "GEOM_Gen_i.hh" +#include +#include +#include +#include + +Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript) +{ + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy); + if(CORBA::is_nil(aStudy)) + return new Engines::TMPFile(0); + + SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType()); + if(CORBA::is_nil(aSO)) + return new Engines::TMPFile(0); + + Resource_DataMapOfAsciiStringAsciiString aMap; + TCollection_AsciiString s("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); + + SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO); + for(Itr->InitEx(true); Itr->More(); Itr->Next()) { + SALOMEDS::SObject_var aValue = Itr->Value(); + char* IOR = aValue->GetIOR(); + if(strlen(IOR) > 0) { + CORBA::Object_var obj = _orb->string_to_object(IOR); + GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_narrow(obj); + if(!CORBA::is_nil(GO)) { + TCollection_AsciiString aName(aValue->GetName()); + int p, p2=1, e = aName.Length(); + while ((p = aName.FirstLocationNotInSet(s, p2, e))) { + aName.SetValue(p, '_'); + p2=p; + } + aMap.Bind(TCollection_AsciiString(GO->GetEntry()), aName); + } + } + } + + bool aValidScript; + TCollection_AsciiString aScript = _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, aValidScript); + + int aLen = aScript.Length(); + unsigned char* aBuffer = new unsigned char[aLen+1]; + strcpy((char*)aBuffer, aScript.ToCString()); + + CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; + Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); + isValidScript = aValidScript; + + return aStreamFile._retn(); +} diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index f8537d7d3..19fe6e0c1 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -175,6 +175,10 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, public Engines_Component_i virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR); + virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript); + //********************************************************************************************************// // Internal methods //********************************************************************************************************// diff --git a/src/GEOM_I/Makefile.in b/src/GEOM_I/Makefile.in index ce1b86325..c5710acb6 100644 --- a/src/GEOM_I/Makefile.in +++ b/src/GEOM_I/Makefile.in @@ -51,7 +51,8 @@ LIB_SRC = \ GEOM_ITransformOperations_i.cc \ GEOM_IMeasureOperations_i.cc \ GEOM_IGroupOperations_i.cc \ - GEOM_Gen_i.cc + GEOM_Gen_i.cc \ + GEOM_DumpPython.cc LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl \ GEOM_Gen.idl SALOME_GenericObj.idl -- 2.39.2