diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index c9ecdb43c2..b3c476a516 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -37,6 +37,7 @@ #include "DlgSettingsFemCcxImp.h" #include "DlgSettingsFemExportAbaqusImp.h" #include "DlgSettingsFemGmshImp.h" +#include "DlgSettingsFemInOutVtkImp.h" #include "DlgSettingsFemZ88Imp.h" #include "DlgSettingsFemElmerImp.h" #include "ViewProviderFemMesh.h" @@ -166,6 +167,7 @@ PyMOD_INIT_FUNC(FemGui) // register preferences pages on Import-Export new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","Import-Export")); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","Import-Export")); // add resources and reloads the translators loadFemResource(); diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index 2506626909..6b2c4501bd 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -48,6 +48,7 @@ set(FemGui_MOC_HDRS DlgSettingsFemExportAbaqusImp.h DlgSettingsFemGeneralImp.h DlgSettingsFemGmshImp.h + DlgSettingsFemInOutVtkImp.h DlgSettingsFemZ88Imp.h DlgSettingsFemElmerImp.h PropertyFemMeshItem.h @@ -91,6 +92,7 @@ set(FemGui_UIC_SRCS DlgSettingsFemExportAbaqus.ui DlgSettingsFemGeneral.ui DlgSettingsFemGmsh.ui + DlgSettingsFemInOutVtk.ui DlgSettingsFemZ88.ui DlgSettingsFemElmer.ui TaskCreateNodeSet.ui @@ -149,6 +151,9 @@ SET(FemGui_DLG_SRCS DlgSettingsFemGmsh.ui DlgSettingsFemGmshImp.cpp DlgSettingsFemGmshImp.h + DlgSettingsFemInOutVtk.ui + DlgSettingsFemInOutVtkImp.cpp + DlgSettingsFemInOutVtkImp.h DlgSettingsFemZ88.ui DlgSettingsFemZ88Imp.cpp DlgSettingsFemZ88Imp.h diff --git a/src/Mod/Fem/Gui/DlgSettingsFemInOutVtk.ui b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtk.ui new file mode 100644 index 0000000000..127bcdd81b --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtk.ui @@ -0,0 +1,106 @@ + + + FemGui::DlgSettingsFemInOutVtk + + + + 0 + 0 + 445 + 298 + + + + VTK + + + + + + + + + Qt::Vertical + + + + 20 + 82 + + + + + + + + Import + + + + + + + + Which object to import into + + + + + + + element parameter: All: all elements, highest: highest elements only, FEM: FEM elements only (only edges not belonging to faces and faces not belonging to volumes) + + + + + + Choose in which object to import into + + + 0 + + + ImportObject + + + Mod/Fem/InOutVtk + + + + VTK result object + + + + + FEM mesh object + + + + + FreeCAD result object + + + + + + + + + + + + + + + + + + + Gui::PrefComboBox + QComboBox +
Gui/PrefWidgets.h
+
+
+ + +
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.cpp new file mode 100644 index 0000000000..e6bf2048ca --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.cpp @@ -0,0 +1,85 @@ +/************************************************************************** + * Copyright (c) 2018 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemExportAbaqusCcxImp.cpp * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#include "PreCompiled.h" + +#include "Gui/Application.h" +#include "DlgSettingsFemInOutVtkImp.h" +#include "ui_DlgSettingsFemInOutVtk.h" +#include + +using namespace FemGui; + +DlgSettingsFemInOutVtkImp::DlgSettingsFemInOutVtkImp( QWidget* parent ) + : PreferencePage( parent ), ui(new Ui_DlgSettingsFemInOutVtk) +{ + ui->setupUi(this); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgSettingsFemInOutVtkImp::~DlgSettingsFemInOutVtkImp() +{ + // no need to delete child widgets, Qt does it all for us + delete ui; +} + +void DlgSettingsFemInOutVtkImp::saveSettings() +{ + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/InOutVtk"); + hGrp->SetInt("ImportObject", ui->comboBoxVtkImportObject->currentIndex()); + + ui->comboBoxVtkImportObject->onSave(); +} + +void DlgSettingsFemInOutVtkImp::loadSettings() +{ + ui->comboBoxVtkImportObject->onRestore(); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/Mod/Fem/InOutVtk"); + int index = hGrp->GetInt("ImportObject", 0); + // 0 is standard on first initialize, 0 .. vtk res obj, 1 .. FEM mesh obj, 2 .. FreeCAD res obj + if (index > -1) ui->comboBoxVtkImportObject->setCurrentIndex(index); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgSettingsFemInOutVtkImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + int c_index = ui->comboBoxVtkImportObject->currentIndex(); + ui->retranslateUi(this); + ui->comboBoxVtkImportObject->setCurrentIndex(c_index); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgSettingsFemInOutVtkImp.cpp" diff --git a/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.h b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.h new file mode 100644 index 0000000000..0086946237 --- /dev/null +++ b/src/Mod/Fem/Gui/DlgSettingsFemInOutVtkImp.h @@ -0,0 +1,53 @@ +/******************b******************************************************** + * Copyright (c) 2018 FreeCAD Developers * + * Author: Bernd Hahnebach * + * Based on src/Mod/Fem/Gui/DlgSettingsFemExportAbaqusCcxImp.h * + * * + * This file is part of the FreeCAD CAx development system. * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 59 Temple Place, * + * Suite 330, Boston, MA 02111-1307, USA * + * * + ***************************************************************************/ + + +#ifndef FEMGUI_DLGSETTINGSFEMINOUTVTKIMP_H +#define FEMGUI_DLGSETTINGSFEMINOUTVTKIMP_H + +#include + +namespace FemGui { + +class Ui_DlgSettingsFemInOutVtk; +class DlgSettingsFemInOutVtkImp : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + DlgSettingsFemInOutVtkImp( QWidget* parent = 0 ); + ~DlgSettingsFemInOutVtkImp(); + +protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); + +private: + Ui_DlgSettingsFemInOutVtk* ui; +}; + +} // namespace FemGui + +#endif // FEMGUI_DLGSETTINGSFEMINOUTVTKIMP_H