TopoDS_Shape aShape;
if (aFormatName == "BREP") {
aShape = BREPImport::Import(aFileName, aFormatName, anError, anUnknownLabel);
- } else if (aFormatName == "STEP") {
+ } else if (aFormatName == "STEP" || aFormatName == "STP") {
aShape = STEPImport::Import(aFileName, aFormatName, anError, anUnknownLabel);
}
// Check if shape is valid
#include <list>
#include <string>
+#include <sstream>
#include <algorithm>
bool ExchangePlugin_ImportFormatValidator::parseFormats(const std::list<std::string>& theArguments,
result = false;
continue;
}
- std::string aFormat = anArg.substr(0, aSepPos);
- std::transform(aFormat.begin(), aFormat.end(), aFormat.begin(), toupper);
- outFormats.push_back(aFormat);
+ std::string aFormatList = anArg.substr(0, aSepPos);
+ std::transform(aFormatList.begin(), aFormatList.end(), aFormatList.begin(), toupper);
+ std::istringstream aStream(aFormatList);
+ std::string aFormat;
+ while (std::getline(aStream, aFormat, '|'))
+ outFormats.push_back(aFormat);
}
return result;
}
* and list of corresponding plugins: "BREPImport", "STEPImport"
*/
static bool parseFormats(const std::list<std::string>& theArguments,
- std::list<std::string>& outFormats);
+ std::list<std::string>& outFormats);
public:
/**
* Returns true is the file-name attribute correctly corresponds to the set of
id="import_file_selector"
title="Import file"
path="">
- <validator id="ExchangePlugin_ImportFormat" parameters="BREP:BREPImport,STEP:STEPImport" />
+ <validator id="ExchangePlugin_ImportFormat" parameters="BREP:BREPImport,STEP|STP:STEPImport" />
</file_selector>
</feature>
</group>
#include <Config_WidgetAPI.h>
-#include <QGridLayout>
#include <QFileDialog>
+#include <QGridLayout>
+#include <QLabel>
#include <QLineEdit>
#include <QList>
#include <QObject>
#include <QPushButton>
+#include <QRegExp>
#include <QString>
-#include <QLabel>
#include <memory>
#include <string>
QStringList aValidatorFormats = getValidatorFormats();
foreach(QString eachFormat, aValidatorFormats) {
- aResult << QString("%1 files (*.%1)").arg(eachFormat);
+ QStringList aFormatList = eachFormat.split("|");
+ aResult << QString("%1 files (%2)").arg(aFormatList.value(0))
+ .arg(QStringList(aFormatList).replaceInStrings(QRegExp("^(.*)$"), "*.\\1").join(" "));
}
aResult << QString("All files (*.*)");
return aResult.join(";;");