From 9205db4b774c52ccf5623fb086eb380c99f4fcbe Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Sun, 12 Apr 2015 20:37:10 +0100 Subject: [PATCH] FEM: Fix problem with lost values after editing material properties Now a valid value is stored immediately into object material. Signed-off-by: Przemo Firszt --- src/Mod/Fem/MechanicalMaterial.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Mod/Fem/MechanicalMaterial.py b/src/Mod/Fem/MechanicalMaterial.py index 0020771db..274c458e9 100644 --- a/src/Mod/Fem/MechanicalMaterial.py +++ b/src/Mod/Fem/MechanicalMaterial.py @@ -132,6 +132,8 @@ class _MechanicalMaterialTaskPanel: QtCore.QObject.connect(self.form.pushButton_MatWeb, QtCore.SIGNAL("clicked()"), self.goMatWeb) QtCore.QObject.connect(self.form.cb_materials, QtCore.SIGNAL("activated(int)"), self.chooseMat) + QtCore.QObject.connect(self.form.input_fd_young_modulus, QtCore.SIGNAL("valueChanged(double)"), self.ym_changed) + QtCore.QObject.connect(self.form.spinBox_poisson_ratio, QtCore.SIGNAL("valueChanged(double)"), self.pr_changed) self.previous_material = self.obj.Material self.import_materials() previous_mat_path = self.get_material_path(self.previous_material) @@ -193,6 +195,22 @@ class _MechanicalMaterialTaskPanel: import webbrowser webbrowser.open("http://matweb.com") + def ym_changed(self, value): + import Units + old_ym = Units.Quantity(self.obj.Material['Mechanical_youngsmodulus']) + if old_ym != value: + material = self.obj.Material + material['Mechanical_youngsmodulus'] = unicode(value) + self.obj.Material = material + + def pr_changed(self, value): + import Units + old_pr = Units.Quantity(self.obj.Material['FEM_poissonratio']) + if old_pr != value: + material = self.obj.Material + material['FEM_poissonratio'] = unicode(value) + self.obj.Material = material + def chooseMat(self, index): if index < 0: return