From d91961d950de5e58e150054503455dab5c5ad22a Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 23 Aug 2016 16:46:22 +0300 Subject: [PATCH] Fix for Export test --- src/ExchangeAPI/ExchangeAPI_Export.cpp | 5 ++++- src/ExchangeAPI/ExchangeAPI_Import.cpp | 16 ++++++++++++++-- src/ExchangePlugin/Test/TestExport.py | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/ExchangeAPI/ExchangeAPI_Export.cpp b/src/ExchangeAPI/ExchangeAPI_Export.cpp index 176df43cc..68a0b4645 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Export.cpp @@ -16,6 +16,7 @@ void exportToFile(const std::shared_ptr & thePart, { // TODO(spo): check that thePart is not empty std::shared_ptr aFeature = thePart->addFeature(ExchangePlugin_ExportFeature::ID()); + fillAttribute("Regular", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())); fillAttribute(theSelectionList, aFeature->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID())); fillAttribute(theFileFormat, aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); @@ -29,9 +30,11 @@ void exportToXAO(const std::shared_ptr & thePart, { // TODO(spo): check that thePart is not empty std::shared_ptr aFeature = thePart->addFeature(ExchangePlugin_ExportFeature::ID()); - fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())); + fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())); + fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())); fillAttribute(theAuthor, aFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())); fillAttribute(theGeometryName, aFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())); + fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())); aFeature->execute(); } diff --git a/src/ExchangeAPI/ExchangeAPI_Import.cpp b/src/ExchangeAPI/ExchangeAPI_Import.cpp index 76e818ebb..cf8b40089 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Import.cpp @@ -10,6 +10,8 @@ #include #include //-------------------------------------------------------------------------------------- +#include + ExchangeAPI_Import::ExchangeAPI_Import( const std::shared_ptr & theFeature) : ModelHighAPI_Interface(theFeature) @@ -45,8 +47,18 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aBase = feature(); std::string aPartName = theDumper.name(aBase->document()); - theDumper << aBase << " = model.addImport(" << aPartName << ", " - << aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID()) << ")" << std::endl; + std::string aFilePath = aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value(); + std::string aFrom = "\\"; + std::string aTo = "\\\\"; + for(std::size_t aPos = aFilePath.find(aFrom); + aPos != std::string::npos; + aPos = aFilePath.find(aFrom, aPos)) { + aFilePath.replace(aPos, aFrom.size(), aTo); + aPos += aTo.size(); + } + + theDumper << aBase << " = model.addImport(" << aPartName << ", \"" + << aFilePath << "\")" << std::endl; // to make import have results theDumper << "model.do()" << std::endl; diff --git a/src/ExchangePlugin/Test/TestExport.py b/src/ExchangePlugin/Test/TestExport.py index d167177bd..0f6f48aa4 100644 --- a/src/ExchangePlugin/Test/TestExport.py +++ b/src/ExchangePlugin/Test/TestExport.py @@ -90,10 +90,10 @@ def testExportXAO(): aSession.startOperation() aGroup = model.addGroup(aPart, []) - aGroup.defaultResult().data().setName("") aGroup.groupList().setSelectionType("face") aGroup.groupList().append("Box_1_1/Shape1_1") aGroup.groupList().append("Box_1_1/Shape2_1") + aGroup.defaultResult().data().setName("") # aGroupFeature = aSession.activeDocument().addFeature("Group") # aGroupFeature.data().setName("") # aSelectionListAttr = aGroupFeature.selectionList("group_list") -- 2.39.2