X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FExchangePlugin%2FExchangePlugin_Dump.cpp;h=d9effab930aee2af11c5e5845650d4fc76184be0;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=f0f740671d174ba28fbffc8ed8972421ca5b78d7;hpb=105ca0409d85455ee48a1caf39f48652761edeb8;p=modules%2Fshaper.git diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index f0f740671..d9effab93 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -50,11 +50,33 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) aDumper->clear(); DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); + int aFeaturesNb = aDoc->size(ModelAPI_Feature::group()); + if(aFeaturesNb > 1) { + FeaturePtr aLastFeature = + ModelAPI_Feature::feature(aDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if(aDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end before dumping."); + return; + } + } + + DocumentPtr anActiveDoc = ModelAPI_Session::get()->activeDocument(); + aFeaturesNb = anActiveDoc->size(ModelAPI_Feature::group()); + if(aFeaturesNb > 1) { + FeaturePtr aLastFeature = + ModelAPI_Feature::feature(anActiveDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); + if(anActiveDoc->currentFeature(true) != aLastFeature) { + setError("Dump cannot be done. Please move the history line to the end before dumping."); + return; + } + } + std::list aFeatures = aDoc->allFeatures(); for(std::list::const_iterator aFeatIt = aFeatures.begin(); aFeatIt != aFeatures.end(); ++aFeatIt) { - ResultPartPtr aResultPart = std::dynamic_pointer_cast((*aFeatIt)->firstResult()); + ResultPartPtr aResultPart = + std::dynamic_pointer_cast((*aFeatIt)->firstResult()); if(aResultPart.get()) { if(!aResultPart->isActivated()) { setError("Error: Not all parts are loaded. Can not dump.");