From 1010659f27425c03bbfc25b377537b3f04885540 Mon Sep 17 00:00:00 2001 From: abd Date: Wed, 6 Aug 2008 10:38:19 +0000 Subject: [PATCH] This version of SMESH module is compatible with OpenFOAM module --- src/SMESH_I/SMESH_DumpPython.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index e1079ebc7..3adbe0db0 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -31,6 +31,7 @@ #include #include +#include #ifdef _DEBUG_ @@ -440,6 +441,35 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy, aScript += DumpPython_impl(aStudy->StudyId(), aMap, aMapNames, isPublished, isValidScript, aSavedTrace); + //inserting export for Object Names + TCollection_AsciiString def = "def RebuildData(theStudy):\n"; + int pos = aScript.Search( def ); + if ( pos != -1 ) + { + //insert global definition + TCollection_AsciiString glob; + for( Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString It(aMap); + It.More(); It.Next() ) + { + TCollection_AsciiString name = It.Value(); + //check valid name + if ( !name.IsEmpty() && name.Search(' ') == -1 && name.Search( ':' ) == -1 + && !name.IsIntegerValue() && !name.IsEqual("Hypotheses") && !name.IsEqual("Algorithms") ) + { + if ( glob.Length() > 0 ) + glob += ','; + glob += name; + } + } + if ( glob.Length() > 0 ) + { + glob.Prepend( "\tglobal " ); + glob += '\n'; + } + + aScript.Insert( pos + def.Length(), glob ); + } + int aLen = aScript.Length(); unsigned char* aBuffer = new unsigned char[aLen+1]; strcpy((char*)aBuffer, aScript.ToCString()); -- 2.39.2