FEM: vtk import, add GUI pref page

This commit is contained in:
Bernd Hahnebach
2018-03-12 15:09:48 +01:00
parent 83f4c7b1f5
commit 975a16a7bc
5 changed files with 251 additions and 0 deletions

View File

@@ -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<FemGui::DlgSettingsFemExportAbaqusImp> (QT_TRANSLATE_NOOP("QObject","Import-Export"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemInOutVtkImp> (QT_TRANSLATE_NOOP("QObject","Import-Export"));
// add resources and reloads the translators
loadFemResource();

View File

@@ -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

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FemGui::DlgSettingsFemInOutVtk</class>
<widget class="QWidget" name="FemGui::DlgSettingsFemInOutVtk">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>445</width>
<height>298</height>
</rect>
</property>
<property name="windowTitle">
<string>VTK</string>
</property>
<property name="toolTip">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>82</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Import</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<layout class="QGridLayout" name="girdLayout">
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string>Which object to import into</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefComboBox" name="comboBoxVtkImportObject">
<property name="toolTip">
<string>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)</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string>Choose in which object to import into</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="prefEntry" stdset="0">
<string>ImportObject</string>
</property>
<property name="prefPath" stdset="0">
<string>Mod/Fem/InOutVtk</string>
</property>
<item>
<property name="text">
<string>VTK result object</string>
</property>
</item>
<item>
<property name="text">
<string>FEM mesh object</string>
</property>
</item>
<item>
<property name="text">
<string>FreeCAD result object</string>
</property>
</item>
<item>
<property name="text">
<string/>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::PrefComboBox</class>
<extends>QComboBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,85 @@
/**************************************************************************
* Copyright (c) 2018 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* 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 <Gui/PrefWidgets.h>
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"

View File

@@ -0,0 +1,53 @@
/******************b********************************************************
* Copyright (c) 2018 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* 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 <Gui/PropertyPage.h>
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