]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for Export test
authordbv <dbv@opencascade.com>
Tue, 23 Aug 2016 13:46:22 +0000 (16:46 +0300)
committerdbv <dbv@opencascade.com>
Tue, 23 Aug 2016 13:46:37 +0000 (16:46 +0300)
src/ExchangeAPI/ExchangeAPI_Export.cpp
src/ExchangeAPI/ExchangeAPI_Import.cpp
src/ExchangePlugin/Test/TestExport.py

index 176df43ccbb063fcd0c5b67ac1706e82b6a38a47..68a0b464536359d64579f4dde80738aa56a17107 100644 (file)
@@ -16,6 +16,7 @@ void exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
 {
   // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> 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<ModelAPI_Document> & thePart,
 {
   // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> 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();
 }
 
index 76e818ebb511a51c4eff4ee8978879407d1ae05c..cf8b40089326b9e928d4b4d54051d8b104224de6 100644 (file)
@@ -10,6 +10,8 @@
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 //--------------------------------------------------------------------------------------
+#include <algorithm>
+
 ExchangeAPI_Import::ExchangeAPI_Import(
     const std::shared_ptr<ModelAPI_Feature> & 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;
 
index d167177bdd052a40c2d5898b888496f6fe1c0a7d..0f6f48aa430f0bb9e372ee47dcda3565da289ab4 100644 (file)
@@ -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")