diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index feeaaeeb8767026fb82c0095fb85caaf1208819d..a7fc34ca87831e402e49e49e4dcc2c65a1d8ffce 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -1022,7 +1022,9 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries, void MainWindow::showFileConverter() { - auto* dlg = new OGSFileConverter(this); + QSettings settings; + auto* dlg = new OGSFileConverter( + settings.value("DataExplorerGmshPath").toString().toStdString(), this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); dlg->raise(); diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp index 8f435727edcbdc57824d179a761e21aa1827e7d8..bd99951551267b7ae34afbce0ab19589c6b4fee8 100644 --- a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp +++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp @@ -29,8 +29,9 @@ #include "MeshLib/IO/VtkIO/VtuInterface.h" #include "MeshLib/Mesh.h" -OGSFileConverter::OGSFileConverter(QWidget* parent) - : QDialog(parent) +OGSFileConverter::OGSFileConverter(std::string const& gmsh_path, + QWidget* parent) + : QDialog(parent), _gmsh_path(gmsh_path) { setupUi(this); } @@ -97,8 +98,8 @@ void OGSFileConverter::convertGLI2GML(const QStringList &input, const QString &o std::string unique_name; std::vector<std::string> errors; - FileIO::Legacy::readGLIFileV4(input_string.toStdString(), - geo_objects, unique_name, errors); + FileIO::Legacy::readGLIFileV4(input_string.toStdString(), geo_objects, + unique_name, errors, _gmsh_path); if (errors.empty() || (errors.size() == 1 && errors[0] == "[readSurface] polyline for surface not found!")) diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.h b/Applications/Utils/OGSFileConverter/OGSFileConverter.h index 54c1b883d2eed9c3aea9bb4a23d9f5d8df3c80df..2d5a0e67057f9181489bf136ec91df10b7817ede 100644 --- a/Applications/Utils/OGSFileConverter/OGSFileConverter.h +++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.h @@ -26,13 +26,14 @@ class OGSFileConverter : public QDialog, private Ui_OGSFileConverter public: /// Constructor - OGSFileConverter(QWidget* parent = nullptr); + OGSFileConverter(std::string const& gmsh_path, QWidget* parent = nullptr); /// Destructor ~OGSFileConverter() override; private: /// Checks if a given file already exists bool fileExists(const std::string &file_name) const; + std::string const _gmsh_path; private slots: /// Converts all files in the input list and writes the new files to the output directory with the same file name + updated extension. diff --git a/Applications/Utils/OGSFileConverter/main.cpp b/Applications/Utils/OGSFileConverter/main.cpp index f31a8b3f0ec0eafe03000e97d898d5363e6b1815..f6876f9c6b01f00cb09de46c2e9f8b8809fa8863 100644 --- a/Applications/Utils/OGSFileConverter/main.cpp +++ b/Applications/Utils/OGSFileConverter/main.cpp @@ -11,7 +11,10 @@ #include <clocale> +#include <tclap/CmdLine.h> + #include "Applications/ApplicationsLib/LogogSetup.h" +#include "BaseLib/BuildInfo.h" #include <QApplication> @@ -20,9 +23,22 @@ int main(int argc, char* argv[]) { ApplicationsLib::LogogSetup logog_setup; + TCLAP::CmdLine cmd( + "A conversion tool for ogs5 and ogs6 files.\n\n" + "OpenGeoSys-6 software, version " + + BaseLib::BuildInfo::git_describe + + ".\n" + "Copyright (c) 2012-2019, OpenGeoSys Community " + "(http://www.opengeosys.org)", + ' ', BaseLib::BuildInfo::git_describe); + TCLAP::ValueArg<std::string> gmsh_path_arg("g", "gmsh-path", + "the path to the gmsh binary", + false, "", "path as string"); + cmd.add(gmsh_path_arg); + cmd.parse( argc, argv ); QApplication app(argc, argv); setlocale(LC_NUMERIC,"C"); - auto* fc = new OGSFileConverter(); + auto* fc = new OGSFileConverter(gmsh_path_arg.getValue()); fc->setWindowTitle( fc->windowTitle() ); fc->show(); int returncode = app.exec();