X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FExchangePlugin%2FExchangePlugin_Dump.cpp;h=aaee3f0034519034e97a43b25cbd67f1f66feeda;hb=4d9c9b53936a9235a30588d1811d91efef81e1f2;hp=418ab137021da7e20a04b4559af537c1feb399db;hpb=1fd15bed1c62f994a3438bc4a12f44d0361f98c9;p=modules%2Fshaper.git diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index 418ab1370..aaee3f003 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2021 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -24,11 +24,14 @@ #include #include #include +#include #include #include +#include + #ifdef EXCHANGEPLUGIN_DUMP_NAMING static const bool THE_DUMP_NAMING = true; #else @@ -67,11 +70,15 @@ void ExchangePlugin_Dump::initAttributes() data()->addAttribute(EXPORT_VARIABLES_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(DUMP_DIR_ID(), ModelAPI_AttributeString::typeId()); + // default values boolean(TOPOLOGICAL_NAMING_DUMP_ID())->setValue(THE_DUMP_NAMING); boolean(GEOMETRIC_DUMP_ID())->setValue(THE_DUMP_GEO); boolean(WEAK_NAMING_DUMP_ID())->setValue(THE_DUMP_WEAK); boolean(EXPORT_VARIABLES_ID())->setValue(false); + + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), DUMP_DIR_ID()); } void ExchangePlugin_Dump::execute() @@ -162,6 +169,16 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) aDumper->addCustomStorage(aWeakNamingStorage); } + // pass dump directory to the dumper + AttributeStringPtr aDumpDirAttr = + this->string(ExchangePlugin_Dump::DUMP_DIR_ID()); + std::string aDumpDir; + if (aDumpDirAttr.get() && aDumpDirAttr->isInitialized()) + aDumpDir = aDumpDirAttr->value(); + else + aDumpDir = GeomAlgoAPI_Tools::File_Tools::path(theFileName); + aDumper->setDumpDir(aDumpDir); + if (!aDumper->process(aDoc, theFileName)) { setError("An error occurred while dumping to " + theFileName); } else {