Merge pull request #10690 from davesrocketshop/material_merge

Material: Material handling enhancements
This commit is contained in:
Chris Hennes
2023-09-27 16:15:06 -05:00
committed by GitHub
402 changed files with 19356 additions and 4377 deletions

View File

@@ -25,8 +25,8 @@
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Gui/Application.h>
#include <Gui/Language/Translator.h>
#include <Gui/WidgetFactory.h>
#include <Gui/Language/Translator.h>
#include "DlgSettingsFemCcxImp.h"
#include "DlgSettingsFemElmerImp.h"
@@ -34,18 +34,25 @@
#include "DlgSettingsFemGeneralImp.h"
#include "DlgSettingsFemGmshImp.h"
#include "DlgSettingsFemInOutVtkImp.h"
#include "DlgSettingsFemMaterialImp.h"
#include "DlgSettingsFemMystranImp.h"
#include "DlgSettingsFemZ88Imp.h"
#include "PropertyFemMeshItem.h"
#include "ViewProviderAnalysis.h"
#include "ViewProviderFemMesh.h"
#include "ViewProviderFemMeshShape.h"
#include "ViewProviderFemMeshShapeNetgen.h"
#include "ViewProviderSetElements.h"
#include "ViewProviderSetFaces.h"
#include "ViewProviderSetGeometry.h"
#include "ViewProviderSetNodes.h"
#include "ViewProviderSolver.h"
#include "ViewProviderFemConstraint.h"
#include "ViewProviderFemConstraintBearing.h"
#include "ViewProviderFemConstraintContact.h"
#include "ViewProviderFemConstraintDisplacement.h"
#include "ViewProviderFemConstraintFixed.h"
#include "ViewProviderFemConstraintFluidBoundary.h"
#include "ViewProviderFemConstraintForce.h"
#include "ViewProviderFemConstraintFluidBoundary.h"
#include "ViewProviderFemConstraintGear.h"
#include "ViewProviderFemConstraintHeatflux.h"
#include "ViewProviderFemConstraintInitialTemperature.h"
@@ -56,15 +63,7 @@
#include "ViewProviderFemConstraintSpring.h"
#include "ViewProviderFemConstraintTemperature.h"
#include "ViewProviderFemConstraintTransform.h"
#include "ViewProviderFemMesh.h"
#include "ViewProviderFemMeshShape.h"
#include "ViewProviderFemMeshShapeNetgen.h"
#include "ViewProviderResult.h"
#include "ViewProviderSetElements.h"
#include "ViewProviderSetFaces.h"
#include "ViewProviderSetGeometry.h"
#include "ViewProviderSetNodes.h"
#include "ViewProviderSolver.h"
#include "Workbench.h"
#ifdef FC_USE_VTK
@@ -178,7 +177,6 @@ PyMOD_INIT_FUNC(FemGui)
new Gui::PrefPageProducer<FemGui::DlgSettingsFemElmerImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMystranImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemZ88Imp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMaterialImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
// register preferences pages on Import-Export
new Gui::PrefPageProducer<FemGui::DlgSettingsFemExportAbaqusImp>(QT_TRANSLATE_NOOP("QObject", "Import-Export"));

View File

@@ -1,8 +1,8 @@
# Many warnings caused by vtk
if(CMAKE_COMPILER_IS_CLANGXX)
add_compile_options(-Wno-pedantic) # needed for vtk headers
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0)
add_compile_options(-Wno-inconsistent-missing-override)
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
@@ -15,12 +15,10 @@ else(MSVC)
add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H)
endif(MSVC)
if(BUILD_FEM_NETGEN)
add_definitions(-DFCWithNetgen)
endif(BUILD_FEM_NETGEN)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
@@ -37,18 +35,15 @@ include_directories(
link_directories(${OCC_LIBRARY_DIR})
link_directories(${SMESH_LIB_PATH})
set(FemGui_LIBS
Fem
FreeCADGui
PartGui
)
generate_from_xml(ViewProviderFemMeshPy)
generate_from_xml(ViewProviderFemPostPipelinePy)
SET(Python_SRCS
ViewProviderFemMeshPy.xml
ViewProviderFemMeshPyImp.cpp
@@ -57,7 +52,6 @@ SET(Python_SRCS
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
set(FemGui_UIC_SRCS
DlgSettingsFemCcx.ui
DlgSettingsFemElmer.ui
@@ -65,7 +59,6 @@ set(FemGui_UIC_SRCS
DlgSettingsFemGeneral.ui
DlgSettingsFemGmsh.ui
DlgSettingsFemInOutVtk.ui
DlgSettingsFemMaterial.ui
DlgSettingsFemMystran.ui
DlgSettingsFemZ88.ui
TaskCreateNodeSet.ui
@@ -88,6 +81,7 @@ set(FemGui_UIC_SRCS
TaskAnalysisInfo.ui
TaskDriver.ui
)
if(BUILD_FEM_VTK)
set(FemGui_UIC_SRCS
${FemGui_UIC_SRCS}
@@ -126,9 +120,6 @@ SET(FemGui_DLG_SRCS
DlgSettingsFemInOutVtk.ui
DlgSettingsFemInOutVtkImp.cpp
DlgSettingsFemInOutVtkImp.h
DlgSettingsFemMaterial.ui
DlgSettingsFemMaterialImp.cpp
DlgSettingsFemMaterialImp.h
DlgSettingsFemMystran.ui
DlgSettingsFemMystranImp.cpp
DlgSettingsFemMystranImp.h
@@ -186,14 +177,13 @@ SET(FemGui_DLG_SRCS
)
SOURCE_GROUP("Constraint-Dialogs" FILES ${FemGui_DLG_SRCS})
set (Fem_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Resources/Fem_translation.qrc)
set(Fem_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Resources/Fem_translation.qrc)
qt_find_and_add_translation(QM_SRCS "Resources/translations/*_*.ts"
${CMAKE_CURRENT_BINARY_DIR}/Resources/translations)
qt_create_resource_file(${Fem_TR_QRC} ${QM_SRCS})
qt_add_resources(FemResource_SRCS Resources/Fem.qrc ${Fem_TR_QRC})
SOURCE_GROUP("Resources" FILES ${FemResource_SRCS})
SET(FemGui_SRCS_ViewProvider
ViewProviderFemMesh.cpp
ViewProviderFemMesh.h
@@ -254,7 +244,6 @@ SET(FemGui_SRCS_ViewProvider
)
SOURCE_GROUP("ViewProvider" FILES ${FemGui_SRCS_ViewProvider})
SET(FemGui_SRCS_TaskBoxes
TaskObjectName.ui
TaskObjectName.cpp
@@ -272,6 +261,7 @@ SET(FemGui_SRCS_TaskBoxes
TaskTetParameter.cpp
TaskTetParameter.h
)
if(BUILD_FEM_VTK)
SET(FemGui_SRCS_TaskBoxes
${FemGui_SRCS_TaskBoxes}
@@ -291,8 +281,8 @@ if(BUILD_FEM_VTK)
TaskPostWarpVector.ui
)
endif(BUILD_FEM_VTK)
SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes})
SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes})
SET(FemGui_SRCS_TaskDlg
TaskDlgCreateNodeSet.h
@@ -304,7 +294,6 @@ SET(FemGui_SRCS_TaskDlg
)
SOURCE_GROUP("Task_Dialogs" FILES ${FemGui_SRCS_TaskDlg})
SET(FemGui_SRCS_Module
AppFemGui.cpp
AppFemGuiPy.cpp
@@ -325,7 +314,6 @@ SET(FemGui_SRCS_Module
)
SOURCE_GROUP("Module" FILES ${FemGui_SRCS_Module})
if(BUILD_FEM_VTK)
SET(FemGui_SRCS_Post
ViewProviderFemPostObject.h
@@ -336,11 +324,10 @@ if(BUILD_FEM_VTK)
ViewProviderFemPostFunction.cpp
ViewProviderFemPostFilter.h
ViewProviderFemPostFilter.cpp
)
)
SOURCE_GROUP("PostObjects" FILES ${FemGui_SRCS_Post})
endif(BUILD_FEM_VTK)
SET(FemGui_SRCS
${Python_SRCS}
${FemGui_DLG_SRCS}
@@ -365,13 +352,10 @@ SET(FemGuiIcon_SVG
add_library(FemGui SHARED ${FemGui_SRCS} ${FemGuiIcon_SVG})
target_link_libraries(FemGui ${FemGui_LIBS} ${VTK_LIBRARIES})
fc_copy_sources(FemGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Fem" ${FemGuiIcon_SVG})
INSTALL(FILES ${FemGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Fem/Resources/icons")
# Python modules ui files, they are copied as they are, thus the need not to be added to Fem.qrc
# see https://forum.freecad.org/viewtopic.php?f=10&t=25833
SET(FemGuiPythonUI_SRCS
@@ -409,10 +393,7 @@ fc_copy_sources(FemPythonUi "${CMAKE_BINARY_DIR}/Mod/Fem" ${FemGuiPythonUI_SRCS}
INSTALL(FILES ${FemGuiPythonUI_SRCS} DESTINATION Mod/Fem/Resources/ui)
SET_BIN_DIR(FemGui FemGui /Mod/Fem)
SET_PYTHON_PREFIX_SUFFIX(FemGui)
INSTALL(TARGETS FemGui DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@@ -1,250 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FemGui::DlgSettingsFemMaterialImp</class>
<widget class="QWidget" name="FemGui::DlgSettingsFemMaterialImp">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<height>229</height>
</rect>
</property>
<property name="windowTitle">
<string>Material</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="gb_4_materials">
<property name="title">
<string>Card resources</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="Gui::PrefCheckBox" name="cb_use_built_in_materials">
<property name="toolTip">
<string>The cards built-in to FreeCAD will be listed as available.</string>
</property>
<property name="text">
<string>Use built-in materials</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBuiltInMaterials</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Resources</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="cb_use_mat_from_config_dir">
<property name="toolTip">
<string>Also cards from FreeCAD's preferences directory will be listed as available.</string>
</property>
<property name="text">
<string>Use materials from Materials directory in user's FreeCAD preference directory</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseMaterialsFromConfigDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Resources</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="cb_use_mat_from_custom_dir">
<property name="toolTip">
<string>Also material cards also from the specified directory
will be listed as available.</string>
</property>
<property name="text">
<string>Use materials from user defined directory</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseMaterialsFromCustomDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Resources</cstring>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="l_custom_mat_dir">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>User directory</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefFileChooser" name="fc_custom_mat_dir">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="prefEntry" stdset="0">
<cstring>CustomMaterialsDir</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Resources</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_4_materials_2">
<property name="title">
<string>Card sorting and duplicates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="Gui::PrefCheckBox" name="cb_delete_duplicates">
<property name="toolTip">
<string>Duplicate cards will be deleted from the displayed material card list.</string>
</property>
<property name="text">
<string>Delete card duplicates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>DeleteDuplicates</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Cards</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="cb_sort_by_resources">
<property name="toolTip">
<string>Material cards appear sorted by their resources (locations).
If unchecked, they will be sorted by their name.</string>
</property>
<property name="text">
<string>Sort by resources</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>SortByResources</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Material/Cards</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>Gui::FileChooser</class>
<extends>QWidget</extends>
<header>Gui/FileDialog.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefFileChooser</class>
<extends>Gui::FileChooser</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/Fem.qrc"/>
</resources>
<connections>
<connection>
<sender>cb_use_mat_from_custom_dir</sender>
<signal>toggled(bool)</signal>
<receiver>fc_custom_mat_dir</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>216</x>
<y>87</y>
</hint>
<hint type="destinationlabel">
<x>316</x>
<y>112</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -1,75 +0,0 @@
/***************************************************************************
* Copyright (c) 2018 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* Based on src/Mod/Fem/Gui/DlgSettingsFemElmerImp.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 "DlgSettingsFemMaterialImp.h"
#include "ui_DlgSettingsFemMaterial.h"
using namespace FemGui;
DlgSettingsFemMaterialImp::DlgSettingsFemMaterialImp(QWidget* parent)
: PreferencePage(parent)
, ui(new Ui_DlgSettingsFemMaterialImp)
{
ui->setupUi(this);
}
DlgSettingsFemMaterialImp::~DlgSettingsFemMaterialImp() = default;
void DlgSettingsFemMaterialImp::saveSettings()
{
ui->cb_use_built_in_materials->onSave();
ui->cb_use_mat_from_config_dir->onSave();
ui->cb_use_mat_from_custom_dir->onSave();
ui->fc_custom_mat_dir->onSave();
ui->cb_delete_duplicates->onSave();
ui->cb_sort_by_resources->onSave();
}
void DlgSettingsFemMaterialImp::loadSettings()
{
ui->cb_use_built_in_materials->onRestore();
ui->cb_use_mat_from_config_dir->onRestore();
ui->cb_use_mat_from_custom_dir->onRestore();
ui->fc_custom_mat_dir->onRestore();
ui->cb_delete_duplicates->onRestore();
ui->cb_sort_by_resources->onRestore();
}
/**
* Sets the strings of the subwidgets using the current language.
*/
void DlgSettingsFemMaterialImp::changeEvent(QEvent* e)
{
if (e->type() == QEvent::LanguageChange) {
ui->retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
#include "moc_DlgSettingsFemMaterialImp.cpp"

View File

@@ -1,55 +0,0 @@
/**************************************************************************
* Copyright (c) 2018 FreeCAD Developers *
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
* Based on src/Mod/Fem/Gui/DlgSettingsFemElmer.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_DLGSETTINGSFEMMATERIALIMP_H
#define FEMGUI_DLGSETTINGSFEMMATERIALIMP_H
#include <Gui/PropertyPage.h>
#include <memory>
namespace FemGui
{
class Ui_DlgSettingsFemMaterialImp;
class DlgSettingsFemMaterialImp: public Gui::Dialog::PreferencePage
{
Q_OBJECT
public:
explicit DlgSettingsFemMaterialImp(QWidget* parent = nullptr);
~DlgSettingsFemMaterialImp() override;
protected:
void saveSettings() override;
void loadSettings() override;
void changeEvent(QEvent* e) override;
private:
std::unique_ptr<Ui_DlgSettingsFemMaterialImp> ui;
};
} // namespace FemGui
#endif // FEMGUI_DLGSETTINGSFEMMATERIALIMP_H