From: spo Date: Thu, 28 May 2015 12:24:24 +0000 (+0300) Subject: Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - If file for export is... X-Git-Tag: V_1.2.0~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0db6518cbadf1b02df67477465a11bcffd007ed9;p=modules%2Fshaper.git Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - If file for export is inputed by hand then file format is from extension and for IGES files it is IGES-5.1 format. --- diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index a67b57bcc..6d3fc8a84 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -77,8 +77,9 @@ void ExchangePlugin_ExportFeature::execute() AttributeStringPtr aFormatAttr = this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); std::string aFormat = aFormatAttr->value(); - if (aFormat.empty()) - return; + // Format may be empty. In this case look at extension. +// if (aFormat.empty()) +// return; AttributeStringPtr aFilePathAttr = this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); @@ -106,6 +107,23 @@ bool ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, TCollection_AsciiString aFileName(theFileName.c_str()); TCollection_AsciiString aFormatName(theFormat.c_str()); + if (theFormat.empty()) { // look at extension + OSD_Path aPath(aFileName); + TCollection_AsciiString anExtension = aPath.Extension(); + // ".brep" -> "BREP", TCollection_AsciiString are numbered from 1 + anExtension = anExtension.SubString(2, anExtension.Length()); + anExtension.UpperCase(); + 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 { + aFormatName = anExtension; + } + } + // Perform the export TCollection_AsciiString anError; TopoDS_Shape aShape(theShape->impl());