FEM: material task panel, improve handling of input fields without unit

This commit is contained in:
Bernd Hahnebach
2021-08-09 15:01:14 +02:00
parent d4acd5160c
commit 04af538d77

View File

@@ -545,8 +545,10 @@ class _TaskPanel:
old_value = Units.Quantity(self.material[matProperty]).getValueAs(qUnit)
else:
# for example PoissonRatio
value = float(inputfield_text)
old_value = float(self.material[matProperty])
value = Units.Quantity(inputfield_text).Value
old_value = Units.Quantity(self.material[matProperty]).Value
# value = float(inputfield_text) # this fails on locale with komma
# https://forum.freecadweb.org/viewtopic.php?f=18&t=56912&p=523313#p523313
if value:
if not (1 - variation < float(old_value) / value < 1 + variation):
material = self.material