Skip to content

Commit

Permalink
FEM: material task panel, improve handling of input fields without unit
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Aug 9, 2021
1 parent aff4172 commit 1f38d89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Mod/Fem/femtaskpanels/task_material_common.py
Expand Up @@ -545,8 +545,10 @@ def update_material_property(self, inputfield_text, matProperty, qUnit, variatio
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
Expand Down

1 comment on commit 1f38d89

@donovaly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Bernd, I think 1f38d89 is not a complete replacement for my PR since it only fixes 2 occurrences of float(). In my PR I addressed 16 problematic float(). Can you please have a look at them too?

Please sign in to comment.