]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1932: error when dump study with not loaded documents
authordbv <dbv@opencascade.com>
Thu, 29 Dec 2016 13:37:24 +0000 (16:37 +0300)
committerdbv <dbv@opencascade.com>
Thu, 29 Dec 2016 13:37:39 +0000 (16:37 +0300)
Changed error message.

src/ExchangePlugin/ExchangePlugin_Dump.cpp

index e81c896aa45666d79de087f4343692445b3d5c36..f0f740671d174ba28fbffc8ed8972421ca5b78d7 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Session.h>
+#include <ModelAPI_ResultPart.h>
 
 #include <ModelHighAPI_Dumper.h>
 
@@ -48,6 +49,20 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName)
   ModelHighAPI_Dumper* aDumper = ModelHighAPI_Dumper::getInstance();
   aDumper->clear();
   DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument();
+
+  std::list<FeaturePtr> aFeatures = aDoc->allFeatures();
+  for(std::list<FeaturePtr>::const_iterator aFeatIt = aFeatures.begin();
+      aFeatIt != aFeatures.end();
+      ++aFeatIt) {
+    ResultPartPtr aResultPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>((*aFeatIt)->firstResult());
+    if(aResultPart.get()) {
+      if(!aResultPart->isActivated()) {
+        setError("Error: Not all parts are loaded. Can not dump.");
+        return;
+      }
+    }
+  }
+
   if (!aDumper || !aDumper->process(aDoc, theFileName))
     setError("An error occured while dumping to " + theFileName);
 }