FEM: Add option to define custom material directory
That commit also tidies up FEM preferences, so all file choosers have the same width Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
parent
0039ea9e72
commit
f7fd04aa2b
|
@ -21,30 +21,30 @@
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="gb_calculix">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
<widget class="QGroupBox" name="gb_calculix">
|
||||||
<horstretch>0</horstretch>
|
<property name="sizePolicy">
|
||||||
<verstretch>0</verstretch>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
</sizepolicy>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
<property name="layoutDirection">
|
</sizepolicy>
|
||||||
<enum>Qt::LeftToRight</enum>
|
</property>
|
||||||
</property>
|
<property name="layoutDirection">
|
||||||
<property name="title">
|
<enum>Qt::LeftToRight</enum>
|
||||||
<string>CalculiX</string>
|
</property>
|
||||||
</property>
|
<property name="title">
|
||||||
<property name="alignment">
|
<string>CalculiX</string>
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
</property>
|
||||||
</property>
|
<property name="alignment">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
<property name="sizeConstraint">
|
</property>
|
||||||
<enum>QLayout::SetNoConstraint</enum>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
</property>
|
<property name="sizeConstraint">
|
||||||
<item>
|
<enum>QLayout::SetNoConstraint</enum>
|
||||||
<layout class="QGridLayout" name="gl_calculix">
|
</property>
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Gui::PrefCheckBox" name="cb_int_editor">
|
<widget class="Gui::PrefCheckBox" name="cb_int_editor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -62,18 +62,24 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hl_ext_editor">
|
<layout class="QGridLayout" name="gl_calculix">
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="l_ext_editor">
|
<widget class="QLabel" name="l_ext_editor">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>External editor:</string>
|
<string>External editor:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="2">
|
||||||
<widget class="Gui::PrefFileChooser" name="fc_ext_editor">
|
<widget class="Gui::PrefFileChooser" name="fc_ext_editor">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -86,38 +92,119 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="Gui::PrefFileChooser" name="fc_ccx_binary">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="sizeIncrement">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Leave blank to use default CalculiX ccx binary file</string>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>ccxBinaryPath</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/Fem</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="l_ccx_binary">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>ccx binary</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
</layout>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_materials">
|
||||||
|
<property name="title">
|
||||||
|
<string>Materials</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="l_ccx_binary">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="text">
|
<item row="1" column="1">
|
||||||
<string>ccx binary</string>
|
<widget class="Gui::PrefFileChooser" name="fc_custom_mat_dir">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
</widget>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
</item>
|
<horstretch>0</horstretch>
|
||||||
<item>
|
<verstretch>0</verstretch>
|
||||||
<widget class="Gui::PrefFileChooser" name="fc_ccx_binary">
|
</sizepolicy>
|
||||||
<property name="toolTip">
|
</property>
|
||||||
<string>Leave blank to use default CalculiX ccx binary file</string>
|
<property name="baseSize">
|
||||||
</property>
|
<size>
|
||||||
<property name="prefEntry" stdset="0">
|
<width>0</width>
|
||||||
<cstring>ccxBinaryPath</cstring>
|
<height>0</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="prefPath" stdset="0">
|
</property>
|
||||||
<cstring>Mod/Fem</cstring>
|
<property name="mode">
|
||||||
</property>
|
<enum>Gui::FileChooser::Directory</enum>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>CustomMaterialsDir</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/Fem</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="l_custom_mat_dir">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>User directory</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
|
@ -172,22 +259,6 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>cb_int_editor</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>l_ext_editor</receiver>
|
|
||||||
<slot>setDisabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>125</x>
|
|
||||||
<y>49</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>120</x>
|
|
||||||
<y>74</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>cb_int_editor</sender>
|
<sender>cb_int_editor</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
|
@ -204,6 +275,22 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>cb_int_editor</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>l_ext_editor</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>125</x>
|
||||||
|
<y>49</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>120</x>
|
||||||
|
<y>74</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>cb_int_editor</sender>
|
<sender>cb_int_editor</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
|
|
|
@ -46,6 +46,7 @@ void DlgSettingsFemImp::saveSettings()
|
||||||
cb_int_editor->onSave();
|
cb_int_editor->onSave();
|
||||||
fc_ext_editor->onSave();
|
fc_ext_editor->onSave();
|
||||||
fc_ccx_binary->onSave();
|
fc_ccx_binary->onSave();
|
||||||
|
fc_custom_mat_dir->onSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgSettingsFemImp::loadSettings()
|
void DlgSettingsFemImp::loadSettings()
|
||||||
|
@ -53,6 +54,7 @@ void DlgSettingsFemImp::loadSettings()
|
||||||
cb_int_editor->onRestore();
|
cb_int_editor->onRestore();
|
||||||
fc_ext_editor->onRestore();
|
fc_ext_editor->onRestore();
|
||||||
fc_ccx_binary->onRestore();
|
fc_ccx_binary->onRestore();
|
||||||
|
fc_custom_mat_dir->onRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -207,5 +207,12 @@ class _MechanicalMaterialTaskPanel:
|
||||||
material_name = os.path.basename(i[:-l])
|
material_name = os.path.basename(i[:-l])
|
||||||
self.form.comboBox_MaterialsInDir.addItem(material_name)
|
self.form.comboBox_MaterialsInDir.addItem(material_name)
|
||||||
self.pathList = self.pathList + user_mat_path_list
|
self.pathList = self.pathList + user_mat_path_list
|
||||||
|
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
|
||||||
|
custom_mat_dir = self.fem_prefs.GetString("CustomMaterialsDir","")
|
||||||
|
custom_mat_path_list = glob.glob(custom_mat_dir + '/*' + mat_file_extension)
|
||||||
|
for i in custom_mat_path_list:
|
||||||
|
material_name = os.path.basename(i[:-l])
|
||||||
|
self.form.comboBox_MaterialsInDir.addItem(material_name)
|
||||||
|
self.pathList = self.pathList + custom_mat_path_list
|
||||||
|
|
||||||
FreeCADGui.addCommand('Fem_MechanicalMaterial',_CommandMechanicalMaterial())
|
FreeCADGui.addCommand('Fem_MechanicalMaterial',_CommandMechanicalMaterial())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user