Fix for "[CEA]: Windows version: Dump Python: there is an error in the file name generated for geompy.ImportXAO" issue.

This commit is contained in:
rnv 2019-05-13 16:41:55 +03:00
parent 25c737135e
commit ee3393d541
6 changed files with 29 additions and 12 deletions

View File

@ -25,6 +25,7 @@
#include "BREPPlugin_IImport.hxx" #include "BREPPlugin_IImport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
// GEOM includes // GEOM includes
@ -102,8 +103,9 @@ void BREPPlugin_IOperations::ExportBREP( const Handle(GEOM_Object) theOrigi
} }
//Make a Python command //Make a Python command
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
GEOM::TPythonDump(aFunction) << "geompy.ExportBREP(" << theOriginal << ", \"" GEOM::TPythonDump(aFunction) << "geompy.ExportBREP(" << theOriginal << ", \""
<< theFileName.ToCString() << "\" )"; << convFileName.c_str() << "\" )";
SetErrorCode(OK); SetErrorCode(OK);
} }
@ -158,7 +160,8 @@ BREPPlugin_IOperations::ImportBREP( const TCollection_AsciiString& theFileName )
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); 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); SetErrorCode(OK);
return aSeq; return aSeq;

View File

@ -25,6 +25,7 @@
#include "IGESPlugin_IImport.hxx" #include "IGESPlugin_IImport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
// GEOM includes // GEOM includes
@ -106,8 +107,9 @@ void IGESPlugin_IOperations::ExportIGES( const Handle(GEOM_Object) theOrigi
} }
//Make a Python command //Make a Python command
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
GEOM::TPythonDump(aFunction) << "geompy.ExportIGES(" << theOriginal << ", \"" GEOM::TPythonDump(aFunction) << "geompy.ExportIGES(" << theOriginal << ", \""
<< theFileName.ToCString() << "\", \"" << theVersion.ToCString() << "\" )"; << convFileName.c_str() << "\", \"" << theVersion.ToCString() << "\" )";
SetErrorCode(OK); SetErrorCode(OK);
} }
@ -164,10 +166,11 @@ IGESPlugin_IOperations::ImportIGES( const TCollection_AsciiString& theFileName,
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
if( theIsIgnoreUnits ) if( theIsIgnoreUnits )
pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)"; pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\", True)";
else else
pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")"; pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\")";
SetErrorCode(OK); SetErrorCode(OK);
return aSeq; return aSeq;

View File

@ -25,6 +25,7 @@
#include "STEPPlugin_IImport.hxx" #include "STEPPlugin_IImport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
// GEOM includes // GEOM includes
@ -151,8 +152,9 @@ void STEPPlugin_IOperations::ExportSTEP
} }
//Make a Python command //Make a Python command
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \"" GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \""
<< theFileName.ToCString() << "\", " << theUnit << " )"; << convFileName.c_str() << "\", " << theUnit << " )";
SetErrorCode(OK); SetErrorCode(OK);
} }
@ -211,7 +213,8 @@ STEPPlugin_IOperations::ImportSTEP(const TCollection_AsciiString& theFileName,
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); 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 << (theIsIgnoreUnits ? "True" : "False");
pd << ", " << (IsCreateAssemblies ? "True" : "False"); pd << ", " << (IsCreateAssemblies ? "True" : "False");
pd << ")"; pd << ")";

View File

@ -25,6 +25,7 @@
#include "STLPlugin_IImport.hxx" #include "STLPlugin_IImport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
// GEOM includes // GEOM includes
@ -111,8 +112,9 @@ void STLPlugin_IOperations::ExportSTL( const Handle(GEOM_Object) theOrigina
} }
//Make a Python command //Make a Python command
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
GEOM::TPythonDump(aFunction) << "geompy.ExportSTL(" << theOriginal << ", \"" GEOM::TPythonDump(aFunction) << "geompy.ExportSTL(" << theOriginal << ", \""
<< theFileName.ToCString() << "\", " << theIsASCII << ", " << theDeflection << ", " << convFileName.c_str() << "\", " << theIsASCII << ", " << theDeflection << ", "
<< theIsRelative << ")"; << theIsRelative << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -168,7 +170,8 @@ STLPlugin_IOperations::ImportSTL( const TCollection_AsciiString& theFileName )
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); 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); SetErrorCode(OK);
return aSeq; return aSeq;

View File

@ -23,6 +23,7 @@
#include "VTKPlugin_IExport.hxx" #include "VTKPlugin_IExport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
// GEOM includes // GEOM includes
@ -101,8 +102,9 @@ void VTKPlugin_IOperations::ExportVTK( const Handle(GEOM_Object) theOrigina
} }
//Make a Python command //Make a Python command
std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
GEOM::TPythonDump(aFunction) << "geompy.ExportVTK(" << theOriginal << ", \"" GEOM::TPythonDump(aFunction) << "geompy.ExportVTK(" << theOriginal << ", \""
<< theFileName.ToCString() << "\", " << theDeflection << ")"; << convFileName.c_str() << "\", " << theDeflection << ")";
SetErrorCode(OK); SetErrorCode(OK);
} }

View File

@ -23,6 +23,7 @@
#include "XAOPlugin_IImportExport.hxx" #include "XAOPlugin_IImportExport.hxx"
// KERNEL includes // KERNEL includes
#include <Basics_DirUtils.hxx>
#include <utilities.h> #include <utilities.h>
#include <Utils_SALOME_Exception.hxx> #include <Utils_SALOME_Exception.hxx>
@ -353,6 +354,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
// make a Python command // make a Python command
GEOM::TPythonDump pd(exportFunction); GEOM::TPythonDump pd(exportFunction);
std::string convFileName = Kernel_Utils::BackSlashToSlash(fileName);
pd << "exported = geompy.ExportXAO(" << shape; pd << "exported = geompy.ExportXAO(" << shape;
// list of groups // list of groups
@ -379,7 +381,7 @@ bool XAOPlugin_IOperations::ExportXAO( Handle(GEOM_Object) shape,
} }
} }
pd << "], "; pd << "], ";
pd << "\"" << author << "\", \"" << fileName << "\", \"" << shapeFileName << "\")"; pd << "\"" << author << "\", \"" << convFileName.c_str() << "\", \"" << shapeFileName << "\")";
SetErrorCode(OK); SetErrorCode(OK);
delete xaoObject; delete xaoObject;
@ -664,8 +666,9 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName,
pd << obj << ((i < nbFields) ? ", " : ""); pd << obj << ((i < nbFields) ? ", " : "");
} }
} }
std::string convFileName = Kernel_Utils::BackSlashToSlash( fileName );
pd << "]"; pd << "]";
pd << ") = geompy.ImportXAO(\"" << fileName << "\")"; pd << ") = geompy.ImportXAO(\"" << convFileName.c_str() << "\")";
delete xaoObject; delete xaoObject;
SetErrorCode(OK); SetErrorCode(OK);