Salome HOME
Task 5.1.7: To be able to export a part to a file and import it into an existing...
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportPart.cpp
index 79de399f8e69c93eb2d4b93be3c5ce25733c72c0..626f835e823da6abdf80df2da9ee313d1f868e77 100644 (file)
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 
+#include <ConstructionPlugin_Axis.h>
+#include <ConstructionPlugin_Plane.h>
+#include <ConstructionPlugin_Point.h>
+
 // Obtain all features to be exported to get the list of selected results.
 static void collectFeatures(AttributeSelectionListPtr theSelected,
                             std::list<FeaturePtr>& theExport);
@@ -145,7 +149,19 @@ void collectConstructions(DocumentPtr theDocument, std::list<FeaturePtr>& theExp
   // keep constructions only
   std::list<FeaturePtr>::iterator anIt = theExport.begin();
   while (anIt != theExport.end()) {
-    if ((*anIt)->lastResult()->groupName() == ModelAPI_ResultConstruction::group())
+    FeaturePtr aCurFeature = *anIt;
+    ResultPtr aCurResult = aCurFeature->lastResult();
+
+    bool isApplicable =
+        (!aCurResult || aCurResult->groupName() == ModelAPI_ResultConstruction::group());
+
+    if (isApplicable && !aCurFeature->isInHistory()) {
+      isApplicable = aCurFeature->getKind() != ConstructionPlugin_Point::ID() &&
+                     aCurFeature->getKind() != ConstructionPlugin_Axis::ID() &&
+                     aCurFeature->getKind() != ConstructionPlugin_Plane::ID();
+    }
+
+    if (isApplicable)
       ++anIt;
     else {
       std::list<FeaturePtr>::iterator aRemoveIt = anIt++;