1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ExchangePlugin_ExportFeature.cpp
4 // Created: May 14, 2015
5 // Author: Sergey POKHODENKO
7 #include <ExchangePlugin_Dump.h>
9 #include <ModelAPI_AttributeString.h>
10 #include <ModelAPI_Document.h>
11 #include <ModelAPI_Session.h>
13 #include <ModelHighAPI_Dumper.h>
15 #include <Config_ModuleReader.h>
18 ExchangePlugin_Dump::ExchangePlugin_Dump()
22 ExchangePlugin_Dump::~ExchangePlugin_Dump()
26 void ExchangePlugin_Dump::initAttributes()
28 data()->addAttribute(ExchangePlugin_Dump::FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
29 data()->addAttribute(ExchangePlugin_Dump::FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId());
32 void ExchangePlugin_Dump::execute()
34 AttributeStringPtr aFilePathAttr =
35 this->string(ExchangePlugin_Dump::FILE_PATH_ID());
36 std::string aFilePath = aFilePathAttr->value();
37 if (aFilePath.empty())
43 void ExchangePlugin_Dump::dump(const std::string& theFileName)
45 // load DumpAssistant from Python side
46 Config_ModuleReader::loadScript("model.dump");
48 ModelHighAPI_Dumper* aDumper = ModelHighAPI_Dumper::getInstance();
50 DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument();
51 if (!aDumper || !aDumper->process(aDoc, theFileName))
52 setError("An error occured while dumping to " + theFileName);