+void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ std::string exportType = aBase->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID())->value();
+
+ if (exportType == "XAOMem") {
+ std::string aGeometryName =
+ aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
+
+ theDumper << "aXAOBuff";
+ std::string aGeometryNamePy;
+ if (! aGeometryName.empty()) {
+ aGeometryNamePy = aGeometryName;
+ }
+ else {
+ aGeometryNamePy = Locale::Convert::toString(aBase->data()->name());
+ }
+ if (! aGeometryNamePy.empty()) {
+ // add shape name
+ std::replace(aGeometryNamePy.begin(), aGeometryNamePy.end(), ' ', '_');
+ theDumper << "_" << aGeometryNamePy;
+ }
+ theDumper << " = model.exportToXAOMem(" << aDocName;
+ AttributeSelectionListPtr aShapeSelected =
+ aBase->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID());
+ if (aShapeSelected->isInitialized() && aShapeSelected->size() == 1) {
+ theDumper << ", " << aShapeSelected->value(0);
+ }
+
+ std::string theAuthor = aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value();
+ if (! theAuthor.empty())
+ theDumper << ", '" << theAuthor << "'";
+ if (! aGeometryName.empty())
+ theDumper << ", '" << aGeometryName << "'";
+ theDumper << ")" << std::endl;
+ return;
+ }
+
+ theDumper << aBase << " = model.";
+
+ if (exportType == "XAO") {
+ std::string aTmpXAOFile =
+ aBase->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value();
+ correctSeparators(aTmpXAOFile);
+ theDumper << "exportToXAO(" << aDocName << ", '" << aTmpXAOFile << "'" ;
+ AttributeSelectionListPtr aShapeSelected =
+ aBase->selectionList(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID());
+ if (aShapeSelected->isInitialized() && aShapeSelected->size() == 1) {
+ theDumper<<", "<<aShapeSelected->value(0);
+ }
+
+ std::string theAuthor = aBase->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value();
+ if (! theAuthor.empty())
+ theDumper << ", '" << theAuthor << "'";
+ std::string theGeometryName =
+ aBase->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
+ if (! theGeometryName.empty())
+ theDumper << ", '" << theGeometryName << "'";
+ theDumper << ")" << std::endl;
+ }
+ else if (exportType == "STL") {
+ std::string aTmpSTLFile =
+ aBase->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value();
+ correctSeparators(aTmpSTLFile);
+ theDumper << "exportToSTL(" << aDocName << ", '" << aTmpSTLFile << "'" ;
+ AttributeSelectionPtr aShapeSelected =
+ aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED());
+
+ theDumper<<","<< aShapeSelected;
+
+ theDumper <<","<< stlabsolute() <<","<< stlrelative();
+
+ if (stldeflectionType()->value()
+ == ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()){
+ theDumper <<","<< "True";
+ }
+ else {
+ theDumper <<","<< "False";
+ }
+
+ if (stlfileType()->value() == ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) {
+ theDumper << "False";
+ }
+ else {
+ theDumper << "True";
+ }
+ theDumper << ")" << std::endl;
+ }
+ else {
+ std::string aFilePath = aBase->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->value();
+ correctSeparators(aFilePath);
+ theDumper << "exportToFile(" << aDocName << ", \"" << aFilePath << "\", " <<
+ aBase->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
+ std::string theFileFormat =
+ aBase->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID())->value();
+ if (!theFileFormat.empty())
+ theDumper << ", '" << theFileFormat << "'";
+ theDumper << ")" << std::endl;
+ }
+}
+
+ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theFilePath,
+ const std::list<ModelHighAPI_Selection> & theSelectionList,
+ const std::string & theFileFormat)