From 9aa9664c1a5ebc7a0f066e977e8d91ba2aaff0e6 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 1 Aug 2016 21:57:05 +0100 Subject: [PATCH] FEM: GUI: pref: move CalculiX related preferences to CalculiX tab --- src/Mod/Fem/FemCommands.py | 5 + src/Mod/Fem/FemToolsCcx.py | 4 +- src/Mod/Fem/Gui/DlgSettingsFem.ui | 413 ++--------------------- src/Mod/Fem/Gui/DlgSettingsFemCcx.ui | 314 ++++++++++++++++- src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp | 36 +- src/Mod/Fem/Gui/DlgSettingsFemImp.cpp | 34 +- src/Mod/Fem/_FemSolverCalculix.py | 8 +- 7 files changed, 380 insertions(+), 434 deletions(-) diff --git a/src/Mod/Fem/FemCommands.py b/src/Mod/Fem/FemCommands.py index d31ffa503ada..635691fda9d8 100644 --- a/src/Mod/Fem/FemCommands.py +++ b/src/Mod/Fem/FemCommands.py @@ -103,6 +103,11 @@ def hide_parts_constraints_show_meshes(self): for acnstrmesh in FemGui.getActiveAnalysis().Member: # if "Constraint" in acnstrmesh.TypeId: # acnstrmesh.ViewObject.Visibility = False + fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem") + hide_constraints = fem_prefs.GetBool("HideConstraint", False) + if hide_constraints: + if "Constraint" in acnstrmesh.TypeId: + acnstrmesh.ViewObject.Visibility = False if "Mesh" in acnstrmesh.TypeId: aparttoshow = acnstrmesh.Name.replace("_Mesh", "") for apart in FreeCAD.activeDocument().Objects: diff --git a/src/Mod/Fem/FemToolsCcx.py b/src/Mod/Fem/FemToolsCcx.py index 83ea7f8adac6..59e90151cd85 100644 --- a/src/Mod/Fem/FemToolsCcx.py +++ b/src/Mod/Fem/FemToolsCcx.py @@ -110,8 +110,8 @@ def write_inp_file(self): def setup_ccx(self, ccx_binary=None, ccx_binary_sig="CalculiX"): from platform import system if not ccx_binary: - self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem") - ccx_binary = self.fem_prefs.GetString("ccxBinaryPath", "") + self.ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Ccx") + ccx_binary = self.ccx_prefs.GetString("ccxBinaryPath", "") if not ccx_binary: if system() == "Linux": ccx_binary = "ccx" diff --git a/src/Mod/Fem/Gui/DlgSettingsFem.ui b/src/Mod/Fem/Gui/DlgSettingsFem.ui index d632ec2f4ca2..9f7c6fdd9542 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFem.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFem.ui @@ -14,7 +14,16 @@ FEM - + + 9 + + + 9 + + + 9 + + 9 @@ -95,133 +104,6 @@ - - - - - 0 - 0 - - - - Qt::LeftToRight - - - CalculiX - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - QLayout::SetNoConstraint - - - - - - - Use internal editor for .inp files - - - true - - - UseInternalEditor - - - Mod/Fem - - - - - - - - - false - - - - 100 - 0 - - - - External editor: - - - - - - - false - - - ExternalEditorPath - - - Mod/Fem - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - Leave blank to use default CalculiX ccx binary file - - - ccxBinaryPath - - - Mod/Fem - - - - - - - - 100 - 0 - - - - ccx binary - - - - - - - - - - @@ -304,170 +186,6 @@ - - - - Default solver settings - - - - - - - - - 148 - 0 - - - - Default type on analysis - - - AnalysisType - - - Mod/Fem - - - - Static - - - - :/icons/fem-new-analysis.svg:/icons/fem-new-analysis.svg - - - - - Frequency - - - - :/icons/fem-frequency-analysis.svg:/icons/fem-frequency-analysis.svg - - - - - Thermomech - - - - :/icons/fem-new-analysis.svg:/icons/fem-new-analysis.svg - - - - - - - - Eigenmode number - - - - - - - Type - - - - - - - 100 - - - 10 - - - NumberOfEigenmode - - - Mod/Fem - - - - - - - High frequency limit - - - - - - - 1 - - - 1000000.000000000000000 - - - 10000.000000000000000 - - - 1000000.000000000000000 - - - EigenmodeHighLimit - - - Mod/Fem - - - - - - - Low frequency limit - - - - - - - 1 - - - 0.000000000000000 - - - 1000000.000000000000000 - - - 10000.000000000000000 - - - 0.000000000000000 - - - EigenmodeLowLimit - - - Mod/Fem - - - - - - - Hz - - - - - - - Hz - - - - - - - - @@ -617,6 +335,28 @@ + + + + true + + + Hide Constraints when plotting results + + + true + + + false + + + HideConstraint + + + Mod/Fem + + + @@ -641,34 +381,19 @@ - - Gui::FileChooser - QWidget -
Gui/FileDialog.h
-
- - Gui::PrefFileChooser - Gui::FileChooser -
Gui/PrefWidgets.h
-
- - Gui::PrefSpinBox - QSpinBox -
Gui/PrefWidgets.h
-
Gui::PrefCheckBox QCheckBox
Gui/PrefWidgets.h
- Gui::PrefComboBox - QComboBox -
Gui/PrefWidgets.h
+ Gui::FileChooser + QWidget +
Gui/FileDialog.h
- Gui::PrefDoubleSpinBox - QDoubleSpinBox + Gui::PrefFileChooser + Gui::FileChooser
Gui/PrefWidgets.h
@@ -676,70 +401,6 @@ - - cb_int_editor - toggled(bool) - l_ext_editor - setEnabled(bool) - - - 100 - 47 - - - 99 - 76 - - - - - cb_int_editor - toggled(bool) - fc_ext_editor - setEnabled(bool) - - - 327 - 54 - - - 323 - 79 - - - - - cb_int_editor - toggled(bool) - l_ext_editor - setDisabled(bool) - - - 125 - 49 - - - 120 - 74 - - - - - cb_int_editor - toggled(bool) - fc_ext_editor - setDisabled(bool) - - - 409 - 50 - - - 406 - 78 - - - cb_use_mat_from_custom_dir toggled(bool) diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui index 0adb95b997b5..dce9aac6eafe 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui @@ -7,7 +7,7 @@ 0 0 555 - 518 + 628 @@ -17,20 +17,140 @@ - + + + + 0 + 0 + + + + Qt::LeftToRight + - Solver preferences + CalculiX - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + QLayout::SetNoConstraint + - - - + + + - Number of CPU's to use (Spooles only) + Use internal editor for .inp files + + + true + + + UseInternalEditor + + + Mod/Fem + + + + + + false + + + + 100 + 0 + + + + External editor: + + + + + + + false + + + ExternalEditorPath + + + Mod/Fem + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Leave blank to use default CalculiX ccx binary file + + + ccxBinaryPath + + + Mod/Fem + + + + + + + + 100 + 0 + + + + ccx binary + + + + + + + + + + + + + + Solver defaults + + + + @@ -127,27 +247,64 @@ + + + + Number of CPU's to use (Spooles only) + + + - + - Hide Constraints when plotting results + Type - - - Hide + + + + 148 + 0 + - - false + + Default type on analysis - HideConstraint + AnalysisType - Mod/Fem/Ccx + Mod/Fem + + + Static + + + + :/icons/fem-new-analysis.svg:/icons/fem-new-analysis.svg + + + + + Frequency + + + + :/icons/fem-frequency-analysis.svg:/icons/fem-frequency-analysis.svg + + + + + Thermomech + + + + :/icons/fem-new-analysis.svg:/icons/fem-new-analysis.svg + + @@ -158,7 +315,7 @@ - Thermo mechanical analysis settings + Thermo mechanical defaults @@ -284,6 +441,117 @@ + + + + Frequency defaults + + + + + + + + 100 + + + 10 + + + NumberOfEigenmode + + + Mod/Fem + + + + + + + Eigenmode number + + + + + + + High frequency limit + + + + + + + 1 + + + 1000000.000000000000000 + + + 10000.000000000000000 + + + 1000000.000000000000000 + + + EigenmodeHighLimit + + + Mod/Fem + + + + + + + Low frequency limit + + + + + + + 1 + + + 0.000000000000000 + + + 1000000.000000000000000 + + + 10000.000000000000000 + + + 0.000000000000000 + + + EigenmodeLowLimit + + + Mod/Fem + + + + + + + Hz + + + + + + + Hz + + + + + + + + @@ -323,6 +591,16 @@ QDoubleSpinBox
Gui/PrefWidgets.h
+ + Gui::FileChooser + QWidget +
Gui/FileDialog.h
+
+ + Gui::PrefFileChooser + Gui::FileChooser +
Gui/PrefWidgets.h
+
diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp index a7bb2944eed0..0640ce27e68b 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcxImp.cpp @@ -47,36 +47,53 @@ void DlgSettingsFemCcxImp::saveSettings() ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Mod/Fem/Ccx"); hGrp->SetInt("Solver", cmb_solver->currentIndex()); - - //OvG: Solver settings + hGrp->SetInt("AnalysisType", cb_analysis_type->currentIndex()); + sb_ccx_numcpu->onSave(); //Number of CPUs cmb_solver->onSave(); cb_ccx_non_lin_geom->onSave(); - cb_hide_constraint->onSave(); - + cb_static->onSave(); sb_ccx_max_iterations->onSave(); //Max number of iterations dsb_ccx_initial_time_step->onSave(); //Initial time step dsb_ccx_analysis_time->onSave(); //Analysis time + + cb_analysis_type->onSave(); + sb_eigenmode_number->onSave(); + dsb_eigenmode_high_limit->onSave(); + dsb_eigenmode_low_limit->onSave(); + + cb_int_editor->onSave(); + fc_ext_editor->onSave(); + fc_ccx_binary->onSave(); } void DlgSettingsFemCcxImp::loadSettings() { - //OvG: Solver settings sb_ccx_numcpu->onRestore(); //Number of CPUs cmb_solver->onRestore(); cb_ccx_non_lin_geom->onRestore(); - cb_hide_constraint->onRestore(); - + cb_static->onRestore(); sb_ccx_max_iterations->onRestore(); //Max number of iterations dsb_ccx_initial_time_step->onRestore(); //Initial time step dsb_ccx_analysis_time->onRestore(); //Analysis time + cb_analysis_type->onRestore(); + sb_eigenmode_number->onRestore(); + dsb_eigenmode_high_limit->onRestore(); + dsb_eigenmode_low_limit->onRestore(); + + cb_int_editor->onRestore(); + fc_ext_editor->onRestore(); + fc_ccx_binary->onRestore(); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Mod/Fem/Ccx"); - int index = hGrp->GetInt("Solver", 0); + int index = hGrp->GetInt("Solver", 0); if (index > -1) cmb_solver->setCurrentIndex(index); + index = hGrp->GetInt("AnalysisType", 0); + if (index > -1) cb_analysis_type->setCurrentIndex(index); } /** @@ -85,6 +102,9 @@ void DlgSettingsFemCcxImp::loadSettings() void DlgSettingsFemCcxImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { + int c_index = cb_analysis_type->currentIndex(); + retranslateUi(this); + cb_analysis_type->setCurrentIndex(c_index); } else { QWidget::changeEvent(e); diff --git a/src/Mod/Fem/Gui/DlgSettingsFemImp.cpp b/src/Mod/Fem/Gui/DlgSettingsFemImp.cpp index c72e949db23c..cb666e617b59 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemImp.cpp +++ b/src/Mod/Fem/Gui/DlgSettingsFemImp.cpp @@ -44,49 +44,34 @@ DlgSettingsFemImp::~DlgSettingsFemImp() void DlgSettingsFemImp::saveSettings() { - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/Mod/Fem"); - hGrp->SetInt("AnalysisType", cb_analysis_type->currentIndex()); - fc_analysis_working_directory->onSave(); - cb_int_editor->onSave(); - fc_ext_editor->onSave(); - fc_ccx_binary->onSave(); + fc_z88_binary->onSave(); - cb_analysis_type->onSave(); - sb_eigenmode_number->onSave(); - dsb_eigenmode_high_limit->onSave(); - dsb_eigenmode_low_limit->onSave(); + cb_use_built_in_materials->onSave(); cb_use_mat_from_config_dir->onSave(); cb_use_mat_from_custom_dir->onSave(); fc_custom_mat_dir->onSave(); + cb_restore_result_dialog->onSave(); cb_keep_results_on_rerun->onSave(); + cb_hide_constraint->onSave(); } void DlgSettingsFemImp::loadSettings() { fc_analysis_working_directory->onRestore(); - cb_int_editor->onRestore(); - fc_ext_editor->onRestore(); - fc_ccx_binary->onRestore(); + fc_z88_binary->onRestore(); - cb_analysis_type->onRestore(); - sb_eigenmode_number->onRestore(); - dsb_eigenmode_high_limit->onRestore(); - dsb_eigenmode_low_limit->onRestore(); + cb_use_built_in_materials->onRestore(); cb_use_mat_from_config_dir->onRestore(); cb_use_mat_from_custom_dir->onRestore(); fc_custom_mat_dir->onRestore(); + cb_restore_result_dialog->onRestore(); cb_keep_results_on_rerun->onRestore(); - - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/Mod/Fem"); - int index = hGrp->GetInt("AnalysisType", 0); - if (index > -1) cb_analysis_type->setCurrentIndex(index); + cb_hide_constraint->onRestore(); } /** @@ -95,9 +80,6 @@ void DlgSettingsFemImp::loadSettings() void DlgSettingsFemImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { - int c_index = cb_analysis_type->currentIndex(); - retranslateUi(this); - cb_analysis_type->setCurrentIndex(c_index); } else { QWidget::changeEvent(e); diff --git a/src/Mod/Fem/_FemSolverCalculix.py b/src/Mod/Fem/_FemSolverCalculix.py index cfe707472132..73581968c9b8 100644 --- a/src/Mod/Fem/_FemSolverCalculix.py +++ b/src/Mod/Fem/_FemSolverCalculix.py @@ -47,7 +47,7 @@ def __init__(self, obj): obj.addProperty("App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis") obj.AnalysisType = FemToolsCcx.FemToolsCcx.known_analysis_types - analysis_type = fem_prefs.GetInt("AnalysisType", 0) + analysis_type = ccx_prefs.GetInt("AnalysisType", 0) obj.AnalysisType = FemToolsCcx.FemToolsCcx.known_analysis_types[analysis_type] known_geom_nonlinear_types = ["linear", "nonlinear"] @@ -60,16 +60,16 @@ def __init__(self, obj): obj.GeometricalNonlinearity = known_geom_nonlinear_types[0] # linear obj.addProperty("App::PropertyIntegerConstraint", "NumberOfEigenmodes", "Fem", "Number of modes for frequency calculations") - noe = fem_prefs.GetInt("NumberOfEigenmodes", 10) + noe = ccx_prefs.GetInt("NumberOfEigenmodes", 10) obj.NumberOfEigenmodes = (noe, 1, 100, 1) obj.addProperty("App::PropertyFloatConstraint", "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations") # Not yet in prefs, so it will always default to 0.0 - ell = fem_prefs.GetFloat("EigenmodeLowLimit", 0.0) + ell = ccx_prefs.GetFloat("EigenmodeLowLimit", 0.0) obj.EigenmodeLowLimit = (ell, 0.0, 1000000.0, 10000.0) obj.addProperty("App::PropertyFloatConstraint", "EigenmodeHighLimit", "Fem", "High frequency limit for eigenmode calculations") - ehl = fem_prefs.GetFloat("EigenmodeHighLimit", 1000000.0) + ehl = ccx_prefs.GetFloat("EigenmodeHighLimit", 1000000.0) obj.EigenmodeHighLimit = (ehl, 0.0, 1000000.0, 10000.0) def execute(self, obj):