X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_DumpPython.cxx;h=f2eff5b288c083a20b89ed0d68b93fb90a3888fe;hp=8b589ce00f224a3968cc5c765cce5eba6a7322c7;hb=a2e43e2ea850da3884a19783b79f3a0862fd6a6c;hpb=920fe932b10ce5e9da132f0fce3be2bbef95fa3a diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 8b589ce00..f2eff5b28 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -53,10 +53,10 @@ namespace SMESH size_t TPythonDump::myCounter = 0; const char theNotPublishedObjectName[] = "__NOT__Published__Object__"; - TVar::TVar(CORBA::Double value):myVals(1) { myVals[0] = SMESH_Comment(value); } - TVar::TVar(CORBA::Long value):myVals(1) { myVals[0] = SMESH_Comment(value); } - TVar::TVar(CORBA::Short value):myVals(1) { myVals[0] = SMESH_Comment(value); } - TVar::TVar(const SMESH::double_array& value):myVals(value.length()) + TVar::TVar(CORBA::Double value):myVals(1), myIsList(false) { myVals[0] = SMESH_Comment(value); } + TVar::TVar(CORBA::Long value):myVals(1), myIsList(false) { myVals[0] = SMESH_Comment(value); } + TVar::TVar(CORBA::Short value):myVals(1), myIsList(false) { myVals[0] = SMESH_Comment(value); } + TVar::TVar(const SMESH::double_array& value):myVals(value.length()), myIsList(true) { for ( size_t i = 0; i < value.length(); i++) myVals[i] = SMESH_Comment(value[i]); @@ -93,7 +93,7 @@ namespace SMESH operator<<(const TVar& theVarValue) { const std::vector< int >& varIDs = SMESH_Gen_i::GetSMESHGen()->GetLastParamIndices(); - if ( theVarValue.myVals.size() != 1 ) + if ( theVarValue.myIsList ) { myStream << "[ "; for ( size_t i = 1; i <= theVarValue.myVals.size(); ++i ) @@ -162,6 +162,13 @@ namespace SMESH return *this; } + TPythonDump& + TPythonDump:: + operator<<(const std::string& theArg){ + myStream< smeshBuilder.py API, "smesh" standing for SMESH_Gen + // For the conversion of IDL API calls -> smeshBuilder.py API, "smesh" standing for SMESH_Gen // was replaces with "smeshgen" (==TPythonDump::SMESHGenName()). // Change "smesh" -> "smeshgen" in the trace saved before passage to smeshBuilder.py API bool isNewVersion = @@ -1187,26 +1208,28 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl } // import python files corresponding to plugins if they are used in anUpdatedScript { - TCollection_AsciiString importStr; + //TCollection_AsciiString importStr; std::vector pluginNames = getPluginNames(); for ( size_t i = 0; i < pluginNames.size(); ++i ) { // Convert access to plugin members: - // e.g. StdMeshers.QUAD_REDUCED -> StdMeshersBuilder.QUAD_REDUCED + // e.g. StdMeshers.QUAD_REDUCED -> smeshBuilder.QUAD_REDUCED TCollection_AsciiString pluginAccess = (pluginNames[i] + ".").c_str() ; int iFrom = 1, iPos; while (( iPos = anUpdatedScript.Location( pluginAccess, iFrom, anUpdatedScript.Length() ))) { - anUpdatedScript.Insert( iPos + pluginNames[i].size(), "Builder" ); - iFrom = iPos + pluginNames[i].size() + 8; + //anUpdatedScript.Insert( iPos + pluginNames[i].size(), "Builder" ); + anUpdatedScript.Remove( iPos, pluginNames[i].size() ); + anUpdatedScript.Insert( iPos, "smeshBuilder" ); + iFrom = iPos - pluginNames[i].size() + 12; } // if any plugin member is used, import the plugin - if ( iFrom > 1 ) - importStr += ( helper + "\n" "from salome." + pluginNames[i].c_str() + - " import " + pluginNames[i].c_str() +"Builder" ); + // if ( iFrom > 1 ) + // importStr += ( helper + "\n" "from salome." + pluginNames[i].c_str() + + // " import " + pluginNames[i].c_str() +"Builder" ); } - if ( !importStr.IsEmpty() ) - initPart += importStr + "\n"; + // if ( !importStr.IsEmpty() ) + // initPart += importStr + "\n"; } if ( isMultiFile ) @@ -1312,7 +1335,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl { // find the function name int functBeg = posAlready; - char* script = (char*) anUpdatedScript.ToCString() + posAlready - 1; // look at ":" after "def fuction()" + char* script = (char*) anUpdatedScript.ToCString() + posAlready - 1; // look at ":" after "def function()" while ( *script != ' ' ) { script--; functBeg--;