Salome HOME
Update TestConstraintEqual.py
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.cpp
index 882a14a00092a431b9e0fa0967d548048bfa63de..a399b646ee9ac6108fad65f45bfc9896a973ec7e 100644 (file)
@@ -26,8 +26,6 @@
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultBody.h>
 
-#include <TopoDS_Shape.hxx>
-
 #include <algorithm>
 #include <iterator>
 #include <string>
@@ -58,8 +56,8 @@ const std::string& ExchangePlugin_ExportFeature::getKind()
  */
 void ExchangePlugin_ExportFeature::initAttributes()
 {
-  data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
 }
 
@@ -85,7 +83,12 @@ void ExchangePlugin_ExportFeature::execute()
       this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
   std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
   for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; ++i) {
-    aShapes.push_back(aSelectionListAttr->value(i)->value());
+    AttributeSelectionPtr anAttrSelection = aSelectionListAttr->value(i);
+    std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
+    if (aCurShape.get() == NULL)
+      aCurShape = anAttrSelection->context()->shape();
+    if (aCurShape.get() != NULL)
+      aShapes.push_back(aCurShape);
   }
   std::shared_ptr<GeomAPI_Shape> aShape =
       GeomAlgoAPI_CompoundBuilder::compound(aShapes);