- // retrieve the file and plugin library names
- TCollection_AsciiString aFileName(theFileName.c_str());
- TCollection_AsciiString aFormatName(theFormat.c_str());
+ std::string aFormatName = theFormat;
+
+ if (aFormatName.empty()) { // get default format for the extension
+ // ".brep" -> "BREP"
+ std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFileName);
+ if (anExtension == "BREP" || anExtension == "BRP") {
+ aFormatName = "BREP";
+ } else if (anExtension == "STEP" || anExtension == "STP") {
+ aFormatName = "STEP";
+ } else if (anExtension == "IGES" || anExtension == "IGS") {
+ aFormatName = "IGES-5.1";
+ } else if (anExtension == "XAO") {
+ aFormatName = "XAO";
+ } else {
+ aFormatName = anExtension;
+ }
+ }
+
+ if (aFormatName == "XAO") {
+ exportXAO(theFileName, theShape);
+ return;
+ }