1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <ExchangePlugin_ExportFeature.h>
30 #include <Config_Common.h>
31 #include <Config_PropManager.h>
33 #include <GeomAlgoAPI_BREPExport.h>
34 #include <GeomAlgoAPI_CompoundBuilder.h>
35 #include <GeomAlgoAPI_IGESExport.h>
36 #include <GeomAlgoAPI_STEPExport.h>
37 #include <GeomAlgoAPI_Tools.h>
38 #include <GeomAlgoAPI_XAOExport.h>
40 #include <GeomAPI_Shape.h>
41 #include <GeomAPI_ShapeExplorer.h>
42 #include <GeomAPI_Trsf.h>
44 #include <Locale_Convert.h>
46 #include <ModelAPI_AttributeSelectionList.h>
47 #include <ModelAPI_AttributeString.h>
48 #include <ModelAPI_AttributeStringArray.h>
49 #include <ModelAPI_AttributeIntArray.h>
50 #include <ModelAPI_AttributeTables.h>
51 #include <ModelAPI_Data.h>
52 #include <ModelAPI_Document.h>
53 #include <ModelAPI_Object.h>
54 #include <ModelAPI_ResultBody.h>
55 #include <ModelAPI_ResultPart.h>
56 #include <ModelAPI_ResultGroup.h>
57 #include <ModelAPI_ResultField.h>
58 #include <ModelAPI_Session.h>
59 #include <ModelAPI_Validator.h>
60 #include <ModelAPI_Tools.h>
62 #include <Events_InfoMessage.h>
64 #include <XAO_Group.hxx>
65 #include <XAO_Field.hxx>
66 #include <XAO_Xao.hxx>
67 #include <XAO_Geometry.hxx>
69 #include <ExchangePlugin_Tools.h>
71 ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
75 ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature()
77 // TODO Auto-generated destructor stub
81 * Request for initialization of data model of the feature: adding all attributes
83 void ExchangePlugin_ExportFeature::initAttributes()
85 data()->addAttribute(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
86 ModelAPI_AttributeString::typeId());
87 data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(),
88 ModelAPI_AttributeString::typeId());
89 data()->addAttribute(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
90 ModelAPI_AttributeString::typeId());
91 data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
92 ModelAPI_AttributeString::typeId());
93 data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
94 ModelAPI_AttributeSelectionList::typeId());
95 data()->addAttribute(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
96 ModelAPI_AttributeString::typeId());
97 data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
98 ModelAPI_AttributeString::typeId());
99 data()->addAttribute(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID(),
100 ModelAPI_AttributeSelectionList::typeId());
102 ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
103 ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID());
104 ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
105 ExchangePlugin_ExportFeature::XAO_AUTHOR_ID());
106 ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
107 ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID());
108 ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
109 ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID());
111 // to support previous version of document, move the selection list
112 // if the type of export operation is XAO
113 AttributeStringPtr aTypeAttr = string(EXPORT_TYPE_ID());
114 if (aTypeAttr->isInitialized() && aTypeAttr->value() == "XAO") {
115 bool aWasBlocked = data()->blockSendAttributeUpdated(true, false);
116 AttributeSelectionListPtr aSelList = selectionList(SELECTION_LIST_ID());
117 AttributeSelectionListPtr aXAOSelList = selectionList(XAO_SELECTION_LIST_ID());
118 if (aSelList->size() > 0 && aXAOSelList->size() == 0)
119 aSelList->copyTo(aXAOSelList);
121 data()->blockSendAttributeUpdated(aWasBlocked, false);
125 void ExchangePlugin_ExportFeature::attributeChanged(const std::string& theID)
127 if (theID == XAO_FILE_PATH_ID()) {
128 string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
129 string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value());
134 * Computes or recomputes the results
136 void ExchangePlugin_ExportFeature::execute()
138 AttributeStringPtr aFormatAttr =
139 this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
140 std::string aFormat = aFormatAttr->value();
142 AttributeStringPtr aFilePathAttr =
143 this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
144 std::string aFilePath = aFilePathAttr->value();
145 if (aFilePath.empty())
148 exportFile(aFilePath, aFormat);
151 void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName,
152 const std::string& theFormat)
154 std::string aFormatName = theFormat;
156 if (aFormatName.empty()) { // get default format for the extension
158 std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName);
159 if (anExtension == "BREP" || anExtension == "BRP") {
160 aFormatName = "BREP";
161 } else if (anExtension == "STEP" || anExtension == "STP") {
162 aFormatName = "STEP";
163 } else if (anExtension == "IGES" || anExtension == "IGS") {
164 aFormatName = "IGES-5.1";
166 aFormatName = anExtension;
170 if (aFormatName == "XAO") {
171 exportXAO(theFileName);
175 // make shape for export from selected shapes
176 AttributeSelectionListPtr aSelectionListAttr =
177 this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
178 std::list<GeomShapePtr> aShapes;
179 for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; ++i) {
180 AttributeSelectionPtr anAttrSelection = aSelectionListAttr->value(i);
181 std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
182 if (aCurShape.get() == NULL)
183 aCurShape = anAttrSelection->context()->shape();
184 if (aCurShape.get() != NULL)
185 aShapes.push_back(aCurShape);
188 // Store compound if we have more than one shape.
189 std::shared_ptr<GeomAPI_Shape> aShape =
190 aShapes.size() == 1 ? aShapes.front() : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
192 // Perform the export
194 bool aResult = false;
195 if (aFormatName == "BREP") {
196 aResult = BREPExport(theFileName, aFormatName, aShape, anError);
197 } else if (aFormatName == "STEP") {
198 aResult = STEPExport(theFileName, aFormatName, aShape, anError);
199 } else if (aFormatName.substr(0, 4) == "IGES") {
200 aResult = IGESExport(theFileName, aFormatName, aShape, anError);
202 anError = "Unsupported format: " + aFormatName;
205 if (!aResult || !anError.empty()) {
206 setError("An error occurred while exporting " + theFileName + ": " + anError);
211 /// Returns XAO string by the value from the table
212 static std::string valToString(const ModelAPI_AttributeTables::Value& theVal,
213 const ModelAPI_AttributeTables::ValueType& theType) {
214 std::ostringstream aStr; // the resulting string value
216 case ModelAPI_AttributeTables::BOOLEAN:
217 aStr<<(theVal.myBool ? "true" : "false");
219 case ModelAPI_AttributeTables::INTEGER:
222 case ModelAPI_AttributeTables::DOUBLE:
223 aStr<<theVal.myDouble;
225 case ModelAPI_AttributeTables::STRING:
232 /// Returns true if something in selection is presented in the results list
233 static bool isInResults(AttributeSelectionListPtr theSelection,
234 const std::list<ResultPtr>& theResults,
235 std::set<ResultPtr>& theCashedResults)
237 // collect all results into a cashed set
238 if (theCashedResults.empty()) {
239 std::list<ResultPtr>::const_iterator aRes = theResults.cbegin();
240 for(; aRes != theResults.cend(); aRes++) {
241 if (theCashedResults.count(*aRes))
244 theCashedResults.insert(*aRes);
245 if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) {
246 ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
247 std::list<ResultPtr> aResults;
248 ModelAPI_Tools::allSubs(aResBody, aResults, false);
249 for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
250 theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
252 } else if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { // all results of the part
253 ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
254 DocumentPtr aPartDoc = aResPart->partDoc();
255 if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
258 int aBodyCount = aPartDoc->size(ModelAPI_ResultBody::group());
259 for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
260 ResultBodyPtr aResBody =
261 std::dynamic_pointer_cast<ModelAPI_ResultBody>(
262 aPartDoc->object(ModelAPI_ResultBody::group(), aBodyIndex));
263 if (aResBody.get()) {
264 theCashedResults.insert(aResBody);
265 std::list<ResultPtr> aResults;
266 ModelAPI_Tools::allSubs(aResBody, aResults, false);
267 for(std::list<ResultPtr>::iterator aR = aResults.begin(); aR != aResults.end(); aR++) {
268 theCashedResults.insert(std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aR));
275 // if context is in results, return true
276 for(int a = 0; a < theSelection->size(); a++) {
277 AttributeSelectionPtr anAttr = theSelection->value(a);
278 ResultPtr aContext = anAttr->context();
279 // check is it group selected for groups BOP
280 if (aContext.get() && aContext->groupName() == ModelAPI_ResultGroup::group()) {
281 // it is impossible by used results check which result is used in this group result,
282 // so check the results shapes is it in results of this document or not
283 FeaturePtr aSelFeature =
284 std::dynamic_pointer_cast<ModelAPI_Feature>(theSelection->owner());
285 if (!aSelFeature.get() || aSelFeature->results().empty())
287 GeomShapePtr aGroupResShape = aSelFeature->firstResult()->shape();
289 std::set<ResultPtr>::iterator allResultsIter = theCashedResults.begin();
290 for(; allResultsIter != theCashedResults.end(); allResultsIter++) {
291 GeomShapePtr aResultShape = (*allResultsIter)->shape();
293 GeomAPI_Shape::ShapeType aType =
294 GeomAPI_Shape::shapeTypeByStr(theSelection->selectionType());
295 GeomAPI_ShapeExplorer aGroupResExp(aGroupResShape, aType);
296 for(; aGroupResExp.more(); aGroupResExp.next()) {
297 if (aResultShape->isSubShape(aGroupResExp.current(), false))
298 return true; // at least one shape of the group is in the used results
302 ResultBodyPtr aSelected = std::dynamic_pointer_cast<ModelAPI_ResultBody>(anAttr->context());
303 if (!aSelected.get()) { // try to get selected feature and all its results
304 FeaturePtr aContextFeature = anAttr->contextFeature();
305 if (aContextFeature.get() && !aContextFeature->results().empty()) {
306 const std::list<ResultPtr>& allResluts = aContextFeature->results();
307 std::list<ResultPtr>::const_iterator aResIter = allResluts.cbegin();
308 for(; aResIter != allResluts.cend(); aResIter++) {
309 if (aResIter->get() && theCashedResults.count(*aResIter))
313 } else if (aSelected.get() && theCashedResults.count(aSelected))
319 void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
328 std::string anAuthor = string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID())->value();
329 aXao.setAuthor(anAuthor);
331 // make shape for export from all results
332 std::list<GeomShapePtr> aShapes;
333 std::list<ResultPtr> aResults;
334 std::list<DocumentPtr> aDocuments; /// documents of Parts selected and used in export
335 std::map<DocumentPtr, GeomTrsfPtr> aDocTrsf; /// translation of the part
337 AttributeSelectionListPtr aSelection = selectionList(XAO_SELECTION_LIST_ID());
338 bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0;
339 if (aIsSelection) { // a mode for export to geom result by result
340 for(int a = 0; a < aSelection->size(); a++) {
341 AttributeSelectionPtr anAttr = aSelection->value(a);
342 ResultPtr aBodyContext =
343 std::dynamic_pointer_cast<ModelAPI_Result>(anAttr->context());
344 if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get()) {
345 aResults.push_back(aBodyContext);
346 GeomShapePtr aShape = anAttr->value();
348 aShape = aBodyContext->shape();
349 aShapes.push_back(aShape);
350 if (aBodyContext->groupName() == ModelAPI_ResultPart::group()) {
351 ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aBodyContext);
352 DocumentPtr aPartDoc = aResPart->partDoc();
353 if (!aPartDoc.get() || !aPartDoc->isOpened()) { // document is not accessible
354 std::string msg = "Can not export XAO for not loaded part";
355 Events_InfoMessage("ExportFeature", msg, this).send();
358 aDocuments.push_back(aPartDoc);
359 aDocTrsf[aPartDoc] = aResPart->summaryTrsf();
365 int aBodyCount = document()->size(ModelAPI_ResultBody::group());
366 for (int aBodyIndex = 0; aBodyIndex < aBodyCount; ++aBodyIndex) {
367 ResultBodyPtr aResultBody =
368 std::dynamic_pointer_cast<ModelAPI_ResultBody>(
369 document()->object(ModelAPI_ResultBody::group(), aBodyIndex));
370 if (!aResultBody.get())
372 aShapes.push_back(aResultBody->shape());
373 aResults.push_back(aResultBody);
376 if (aShapes.empty()) {
377 setError("No shapes to export");
382 GeomShapePtr aShape = (aShapes.size() == 1)
384 : GeomAlgoAPI_CompoundBuilder::compound(aShapes);
386 SetShapeToXAO(aShape, &aXao, anError);
388 if (!anError.empty()) {
389 setError("An error occurred while exporting " + theFileName + ": " + anError);
394 std::string aGeometryName = string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID())->value();
395 if (aGeometryName.empty() && aResults.size() == 1) {
396 // get the name from the first result
397 ResultPtr aResultBody = *aResults.begin();
398 aGeometryName = Locale::Convert::toString(aResultBody->data()->name());
401 aXao.getGeometry()->setName(aGeometryName);
403 std::set<ResultPtr> allResultsCashed; // cash to speed up searching in all results selected
405 // iterate all documents used
406 if (aDocuments.empty())
407 aDocuments.push_back(document());
408 std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
409 for(; aDoc != aDocuments.end(); aDoc++) {
411 int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
412 for (int aGroupIndex = 0; aGroupIndex < aGroupCount; ++aGroupIndex) {
413 ResultGroupPtr aResultGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(
414 (*aDoc)->object(ModelAPI_ResultGroup::group(), aGroupIndex));
415 if (!aResultGroup.get() || !aResultGroup->shape().get())
418 FeaturePtr aGroupFeature = (*aDoc)->feature(aResultGroup);
420 AttributeSelectionListPtr aSelectionList =
421 aGroupFeature->selectionList("group_list");
422 if (!isInResults(aSelectionList, aResults, allResultsCashed))// skip group not used in result
425 // conversion of dimension
426 std::string aSelectionType = aSelectionList->selectionType();
427 GeomAPI_Shape::ShapeType aSelType = GeomAPI_Shape::shapeTypeByStr(aSelectionType);
428 std::string aDimensionString =
429 ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
430 XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
432 XAO::Group* aXaoGroup = aXao.addGroup(aGroupDimension,
433 Locale::Convert::toString(aResultGroup->data()->name()));
436 GeomAPI_ShapeExplorer aGroupResExplorer(aResultGroup->shape(), aSelType);
437 for(; aGroupResExplorer.more(); aGroupResExplorer.next()) {
438 GeomShapePtr aGroupShape = aGroupResExplorer.current();
439 if (aDocTrsf.find(*aDoc) != aDocTrsf.end())
440 aGroupShape->move(aDocTrsf[*aDoc]);
441 int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aGroupShape);
442 if (aReferenceID == 0) // selected value does not found in the exported shape
444 std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
446 aXao.getGeometry()->getElementIndexByReference(aGroupDimension, aReferenceString);
447 aXaoGroup->add(anElementID);
449 } catch (XAO::XAO_Exception& e) {
451 std::string msg = "An error occurred while exporting group " +
452 Locale::Convert::toString(aResultGroup->data()->name());
456 msg += "=> skipping this group from XAO export.";
457 Events_InfoMessage("ExportFeature", msg, this).send();
458 aXao.removeGroup(aXaoGroup);
464 int aFieldCount = (*aDoc)->size(ModelAPI_ResultField::group());
465 for (int aFieldIndex = 0; aFieldIndex < aFieldCount; ++aFieldIndex) {
466 ResultFieldPtr aResultField = std::dynamic_pointer_cast<ModelAPI_ResultField>(
467 (*aDoc)->object(ModelAPI_ResultField::group(), aFieldIndex));
469 FeaturePtr aFieldFeature = (*aDoc)->feature(aResultField);
471 AttributeSelectionListPtr aSelectionList =
472 aFieldFeature->selectionList("selected");
473 std::string aSelectionType = aSelectionList->selectionType();
474 bool isWholePart = aSelectionType == "part";
475 // skip field not used in results
476 if (!isWholePart && !isInResults(aSelectionList, aResults, allResultsCashed))
479 // conversion of dimension
480 std::string aDimensionString =
481 ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
482 XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
483 // get tables and their type
484 std::shared_ptr<ModelAPI_AttributeTables> aTables = aFieldFeature->tables("values");
485 std::string aTypeString = ExchangePlugin_Tools::valuesType2xaoType(aTables->type());
486 XAO::Type aFieldType = XAO::XaoUtils::stringToFieldType(aTypeString);
488 XAO::Field* aXaoField = aXao.addField(aFieldType, aFieldDimension, aTables->columns(),
489 Locale::Convert::toString(aResultField->data()->name()));
493 // set components names
494 AttributeStringArrayPtr aComponents = aFieldFeature->stringArray("components_names");
495 for(int aComp = 0; aComp < aComponents->size(); aComp++) {
496 std::string aName = aComponents->value(aComp);
497 aXaoField->setComponentName(aComp, aName);
500 AttributeIntArrayPtr aStamps = aFieldFeature->intArray("stamps");
501 for (int aStepIndex = 0; aStepIndex < aTables->tables(); aStepIndex++) {
502 XAO::Step* aStep = aXaoField->addNewStep(aStepIndex + 1);
503 aStep->setStep(aStepIndex + 1);
504 int aStampIndex = aStamps->value(aStepIndex);
505 aStep->setStamp(aStampIndex);
506 int aNumElements = isWholePart ? aXaoField->countElements() : aTables->rows();
507 int aNumComps = aTables->columns();
508 std::set<int> aFilledIDs; // to fill the rest by defaults
509 // omit default values first row
510 for(int aRow = isWholePart ? 0 : 1; aRow < aNumElements; aRow++) {
511 for(int aCol = 0; aCol < aNumComps; aCol++) {
514 // element index actually is the ID of the selection
515 AttributeSelectionPtr aSel = aSelectionList->value(aRow - 1);
516 int aReferenceID = GeomAlgoAPI_CompoundBuilder::id(aShape, aSel->value());
517 if (aReferenceID == 0) // selected value does not found in the exported shape
520 std::string aReferenceString = XAO::XaoUtils::intToString(aReferenceID);
521 anElementID = aXao.getGeometry()->
522 getElementIndexByReference(aFieldDimension, aReferenceString);
525 ModelAPI_AttributeTables::Value aVal = aTables->value(
526 isWholePart ? 0 : aRow, aCol, aStepIndex);
527 std::string aStrVal = valToString(aVal, aTables->type());
528 aStep->setStringValue(isWholePart ? aRow : anElementID, aCol, aStrVal);
529 aFilledIDs.insert(anElementID);
532 if (!isWholePart) { // fill the rest values by default ones
533 XAO::GeometricElementList::iterator allElem =
534 aXao.getGeometry()->begin(aFieldDimension);
535 for(; allElem != aXao.getGeometry()->end(aFieldDimension); allElem++) {
536 if (aFilledIDs.find(allElem->first) != aFilledIDs.end())
538 for(int aCol = 0; aCol < aNumComps; aCol++) {
540 ModelAPI_AttributeTables::Value aVal = aTables->value(0, aCol, aStepIndex);
541 std::string aStrVal = valToString(aVal, aTables->type());
542 aStep->setStringValue(allElem->first, aCol, aStrVal);
547 } catch (XAO::XAO_Exception& e) {
549 std::string msg = "An error occurred while exporting field " +
550 Locale::Convert::toString(aResultField->data()->name());
554 msg += "=> skipping this field from XAO export.";
555 Events_InfoMessage("ExportFeature", msg, this).send();
556 aXao.removeField(aXaoField);
563 XAOExport(theFileName, &aXao, anError);
565 if (!anError.empty()) {
566 setError("An error occurred while exporting " + theFileName + ": " + anError);
571 } catch (XAO::XAO_Exception& e) {
572 std::string anError = e.what();
573 setError("An error occurred while exporting " + theFileName + ": " + anError);
579 bool ExchangePlugin_ExportFeature::isMacro() const
581 if (!data().get() || !data()->isValid())
583 ExchangePlugin_ExportFeature* aThis = ((ExchangePlugin_ExportFeature*)(this));
584 AttributeStringPtr aFormatAttr = aThis->string(FILE_FORMAT_ID());
585 std::string aFormat(aFormatAttr.get() ? aFormatAttr->value() : "");
587 if (aFormat.empty()) { // get default format for the extension
588 AttributeStringPtr aFilePathAttr = aThis->string(FILE_PATH_ID());
589 std::string aFilePath = aFilePathAttr->value();
590 if (!aFilePath.empty()) {
591 std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath);
592 aFormat = anExtension;
596 if (aFormat == "XAO") { // on export to GEOM the selection attribute is filled - this is
597 // an exceptional case where export to XAO feature must be kept
598 AttributeSelectionListPtr aList = aThis->selectionList(XAO_SELECTION_LIST_ID());
599 return !aList->isInitialized() || aList->size() == 0;