X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM%2FGEOM_Engine.cxx;h=5693abcebe0a1d7ba7d755acff8f016605beb9bc;hb=6c057505a6e4bcff162cfb8b86deeda0eefff60a;hp=335f53435bc43913b6c2677ac4ed601aaeb61b1c;hpb=7a2ad46e4ce00680f42a925dda07a74018a659c9;p=modules%2Fgeom.git diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 335f53435..5693abceb 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -419,35 +419,35 @@ void GEOM_Engine::Close(int theDocID) * DumpPython */ //============================================================================= -TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, +TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, Resource_DataMapOfAsciiStringAsciiString& theObjectNames, - bool isPublished, + bool isPublished, bool& aValidScript) { TCollection_AsciiString aScript; Handle(TDocStd_Document) aDoc = GetDocument(theDocID); - - if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); - + + if (aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); + aScript = "import geompy\n"; aScript += "import math\n"; aScript += "import SALOMEDS\n\n"; aScript += "def RebuildData(theStudy):"; aScript += "\n\tgeompy.init_geom(theStudy)"; - + Standard_Integer posToInertGlobalVars = aScript.Length() + 1; Handle(TDataStd_TreeNode) aNode, aRoot; Handle(GEOM_Function) aFunction; TColStd_MapOfTransient aMap; - if(aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { + if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { TDataStd_ChildNodeIterator Itr(aRoot); - for(; Itr.More(); Itr.Next()) { + for (; Itr.More(); Itr.Next()) { aNode = Itr.Value(); aFunction = GEOM_Function::GetFunction(aNode->Label()); - if(aFunction.IsNull()) { - cout << "Null function !!!!" << endl; + if (aFunction.IsNull()) { + MESSAGE ( "Null function !!!!" ); continue; } ProcessFunction(aFunction, aScript, aMap); @@ -482,12 +482,12 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, //Replace entries by the names TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"), allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); - if(aLen == 0) anUpdatedScript = aScript; + if (aLen == 0) anUpdatedScript = aScript; - for(Standard_Integer i = 1; i <= aLen; i+=2) { + 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)) { + if (theObjectNames.IsBound(anEntry)) { aName = theObjectNames.Find(anEntry); // check validity of aName bool isValidName = true; @@ -530,8 +530,9 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, } //Add final part of the script - if(aLen && aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865 - + if (aLen && aSeq->Value(aLen) < aScriptLength) + anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865 + // ouv : NPAL12872 for (anEntryToNameIt.Initialize( theObjectNames ); anEntryToNameIt.More(); @@ -612,7 +613,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, } } - anUpdatedScript += "\n\tpass\n"; + //anUpdatedScript += "\n\tpass\n"; + anUpdatedScript += "\n"; aValidScript = true; // fill _studyEntry2NameMap and build globalVars @@ -633,7 +635,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, globalVars.Insert( 1, "\n\tglobal " ); anUpdatedScript.Insert( posToInertGlobalVars, globalVars ); } - + return anUpdatedScript; } @@ -714,7 +716,7 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin Standard_Integer aLen = theString.Length(); Standard_Boolean isFound = Standard_False; - char* arr = theString.ToCString(); + const char* arr = theString.ToCString(); Standard_Integer i = 0, j; while(i < aLen) {