From ee3393d541fb26cc63b332cb538b8c67a0067a96 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 13 May 2019 16:41:55 +0300 Subject: [PATCH] Fix for "[CEA]: Windows version: Dump Python: there is an error in the file name generated for geompy.ImportXAO" issue. --- src/BREPPlugin/BREPPlugin_IOperations.cxx | 7 +++++-- src/IGESPlugin/IGESPlugin_IOperations.cxx | 9 ++++++--- src/STEPPlugin/STEPPlugin_IOperations.cxx | 7 +++++-- src/STLPlugin/STLPlugin_IOperations.cxx | 7 +++++-- src/VTKPlugin/VTKPlugin_IOperations.cxx | 4 +++- src/XAOPlugin/XAOPlugin_IOperations.cxx | 7 +++++-- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/BREPPlugin/BREPPlugin_IOperations.cxx b/src/BREPPlugin/BREPPlugin_IOperations.cxx index 41e1a070b..c5ab6d630 100644 --- a/src/BREPPlugin/BREPPlugin_IOperations.cxx +++ b/src/BREPPlugin/BREPPlugin_IOperations.cxx @@ -25,6 +25,7 @@ #include "BREPPlugin_IImport.hxx" // KERNEL includes +#include #include // GEOM includes @@ -102,8 +103,9 @@ void BREPPlugin_IOperations::ExportBREP( const Handle(GEOM_Object) theOrigi } //Make a Python command + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); GEOM::TPythonDump(aFunction) << "geompy.ExportBREP(" << theOriginal << ", \"" - << theFileName.ToCString() << "\" )"; + << convFileName.c_str() << "\" )"; SetErrorCode(OK); } @@ -158,7 +160,8 @@ BREPPlugin_IOperations::ImportBREP( const TCollection_AsciiString& theFileName ) //Make a Python command GEOM::TPythonDump pd (aFunction); - pd << aSeq << " = geompy.ImportBREP(\"" << theFileName.ToCString() << "\" )"; + std::string convFileName = Kernel_Utils::BackSlashToSlash( theFileName.ToCString() ); + pd << aSeq << " = geompy.ImportBREP(\"" << convFileName.c_str() << "\" )"; SetErrorCode(OK); return aSeq; diff --git a/src/IGESPlugin/IGESPlugin_IOperations.cxx b/src/IGESPlugin/IGESPlugin_IOperations.cxx index ca9b3224d..59581817b 100644 --- a/src/IGESPlugin/IGESPlugin_IOperations.cxx +++ b/src/IGESPlugin/IGESPlugin_IOperations.cxx @@ -25,6 +25,7 @@ #include "IGESPlugin_IImport.hxx" // KERNEL includes +#include #include // GEOM includes @@ -106,8 +107,9 @@ void IGESPlugin_IOperations::ExportIGES( const Handle(GEOM_Object) theOrigi } //Make a Python command + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); GEOM::TPythonDump(aFunction) << "geompy.ExportIGES(" << theOriginal << ", \"" - << theFileName.ToCString() << "\", \"" << theVersion.ToCString() << "\" )"; + << convFileName.c_str() << "\", \"" << theVersion.ToCString() << "\" )"; SetErrorCode(OK); } @@ -164,10 +166,11 @@ IGESPlugin_IOperations::ImportIGES( const TCollection_AsciiString& theFileName, //Make a Python command GEOM::TPythonDump pd (aFunction); + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); if( theIsIgnoreUnits ) - pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)"; + pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\", True)"; else - pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")"; + pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\")"; SetErrorCode(OK); return aSeq; diff --git a/src/STEPPlugin/STEPPlugin_IOperations.cxx b/src/STEPPlugin/STEPPlugin_IOperations.cxx index 58a1a611e..06b3cd25e 100644 --- a/src/STEPPlugin/STEPPlugin_IOperations.cxx +++ b/src/STEPPlugin/STEPPlugin_IOperations.cxx @@ -25,6 +25,7 @@ #include "STEPPlugin_IImport.hxx" // KERNEL includes +#include #include // GEOM includes @@ -151,8 +152,9 @@ void STEPPlugin_IOperations::ExportSTEP } //Make a Python command + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \"" - << theFileName.ToCString() << "\", " << theUnit << " )"; + << convFileName.c_str() << "\", " << theUnit << " )"; SetErrorCode(OK); } @@ -211,7 +213,8 @@ STEPPlugin_IOperations::ImportSTEP(const TCollection_AsciiString& theFileName, //Make a Python command GEOM::TPythonDump pd (aFunction); - pd << aSeq << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\", "; + std::string convFileName = Kernel_Utils::BackSlashToSlash( theFileName.ToCString() ); + pd << aSeq << " = geompy.ImportSTEP(\"" << convFileName.c_str() << "\", "; pd << (theIsIgnoreUnits ? "True" : "False"); pd << ", " << (IsCreateAssemblies ? "True" : "False"); pd << ")"; diff --git a/src/STLPlugin/STLPlugin_IOperations.cxx b/src/STLPlugin/STLPlugin_IOperations.cxx index e5b97e365..c0e492a42 100644 --- a/src/STLPlugin/STLPlugin_IOperations.cxx +++ b/src/STLPlugin/STLPlugin_IOperations.cxx @@ -25,6 +25,7 @@ #include "STLPlugin_IImport.hxx" // KERNEL includes +#include #include // GEOM includes @@ -111,8 +112,9 @@ void STLPlugin_IOperations::ExportSTL( const Handle(GEOM_Object) theOrigina } //Make a Python command + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); GEOM::TPythonDump(aFunction) << "geompy.ExportSTL(" << theOriginal << ", \"" - << theFileName.ToCString() << "\", " << theIsASCII << ", " << theDeflection << ", " + << convFileName.c_str() << "\", " << theIsASCII << ", " << theDeflection << ", " << theIsRelative << ")"; SetErrorCode(OK); @@ -168,7 +170,8 @@ STLPlugin_IOperations::ImportSTL( const TCollection_AsciiString& theFileName ) //Make a Python command GEOM::TPythonDump pd (aFunction); - pd << aSeq << " = geompy.ImportSTL(\"" << theFileName.ToCString() << "\" )"; + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); + pd << aSeq << " = geompy.ImportSTL(\"" << convFileName.c_str() << "\" )"; SetErrorCode(OK); return aSeq; diff --git a/src/VTKPlugin/VTKPlugin_IOperations.cxx b/src/VTKPlugin/VTKPlugin_IOperations.cxx index 8ffda5c6e..b5ca0e326 100644 --- a/src/VTKPlugin/VTKPlugin_IOperations.cxx +++ b/src/VTKPlugin/VTKPlugin_IOperations.cxx @@ -23,6 +23,7 @@ #include "VTKPlugin_IExport.hxx" // KERNEL includes +#include #include // GEOM includes @@ -101,8 +102,9 @@ void VTKPlugin_IOperations::ExportVTK( const Handle(GEOM_Object) theOrigina } //Make a Python command + std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString()); GEOM::TPythonDump(aFunction) << "geompy.ExportVTK(" << theOriginal << ", \"" - << theFileName.ToCString() << "\", " << theDeflection << ")"; + << convFileName.c_str() << "\", " << theDeflection << ")"; SetErrorCode(OK); } diff --git a/src/XAOPlugin/XAOPlugin_IOperations.cxx b/src/XAOPlugin/XAOPlugin_IOperations.cxx index f725f43b7..91c0c3e4f 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.cxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.cxx @@ -23,6 +23,7 @@ #include "XAOPlugin_IImportExport.hxx" // KERNEL includes +#include #include #include @@ -353,6 +354,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape, // make a Python command GEOM::TPythonDump pd(exportFunction); + std::string convFileName = Kernel_Utils::BackSlashToSlash(fileName); pd << "exported = geompy.ExportXAO(" << shape; // list of groups @@ -379,7 +381,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape, } } pd << "], "; - pd << "\"" << author << "\", \"" << fileName << "\", \"" << shapeFileName << "\")"; + pd << "\"" << author << "\", \"" << convFileName.c_str() << "\", \"" << shapeFileName << "\")"; SetErrorCode(OK); delete xaoObject; @@ -664,8 +666,9 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName, pd << obj << ((i < nbFields) ? ", " : ""); } } + std::string convFileName = Kernel_Utils::BackSlashToSlash( fileName ); pd << "]"; - pd << ") = geompy.ImportXAO(\"" << fileName << "\")"; + pd << ") = geompy.ImportXAO(\"" << convFileName.c_str() << "\")"; delete xaoObject; SetErrorCode(OK); -- 2.39.2