Python bug with spinBox_poisson_ratio

A forum to discuss the implementation of a good Materials system in FreeCAD
User avatar
uwestoehr
Posts: 782
Joined: Sun Jan 27, 2019 3:21 am

Python bug with spinBox_poisson_ratio

Postby uwestoehr » Mon Mar 11, 2019 11:20 pm

to reproduce:

- open this example file:
Flaschexxx.FCStd
(168.78 KiB) Downloaded 28 times
- double click on the material

result:

Code: Select all

Traceback (most recent call last):
  File "C:\FreeCAD\FreeCAD_0.18.16078_x64_dev_win\Mod\Fem\femguiobjects\_ViewProviderFemMaterial.py", line 71, in setEdit
    taskd = _TaskPanelFemMaterial(self.Object)
  File "C:\FreeCAD\FreeCAD_0.18.16078_x64_dev_win\Mod\Fem\femguiobjects\_ViewProviderFemMaterial.py", line 165, in __init__
    self.choose_material(index)  # fill input fields and set the current material in the cb widget
  File "C:\FreeCAD\FreeCAD_0.18.16078_x64_dev_win\Mod\Fem\femguiobjects\_ViewProviderFemMaterial.py", line 219, in choose_material
    self.set_mat_params_in_input_fields(self.material)
  File "C:\FreeCAD\FreeCAD_0.18.16078_x64_dev_win\Mod\Fem\femguiobjects\_ViewProviderFemMaterial.py", line 509, in set_mat_params_in_input_fields
    self.parameterWidget.spinBox_poisson_ratio.setValue(float(matmap['PoissonRatio']))
<type 'exceptions.ValueError'>: could not convert string to float: 
This happens with
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16078 (Git)
Build type: Release
Branch: master
Hash: 67df9f3a828fbb0fec29d039792d4baf3d9ee8e0
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Germany (de_DE)

and
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16078 (Git)
Build type: Release
Branch: master
Hash: 67df9f3a828fbb0fec29d039792d4baf3d9ee8e0
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Python bug with spinBox_poisson_ratio

Postby bernd » Tue Mar 12, 2019 5:15 am

i can reproduce on:

OS: Debian GNU/Linux buster/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16084 (Git)
Build type: Unknown
Branch: bhbdev203
Hash: 568faf67a05454125db21452c35ce915bceb05cb
Python version: 3.7.2+
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)

attached some code to reproduce with Python only:

Code: Select all

mat = {}
mat['Name'] = ""
mat['YoungsModulus'] = ""
mat['PoissonRatio'] = ""
mat['Density'] = ""

doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D.FCStd')
doc.SolidMaterial.Material = mat
doc.recompute()
and double click on object "SolidMaterial"
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Python bug with spinBox_poisson_ratio

Postby bernd » Tue Mar 12, 2019 5:34 am

User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Python bug with spinBox_poisson_ratio

Postby bernd » Tue Mar 12, 2019 5:41 am

@Uwe:

Which material card did you use to set this?
User avatar
uwestoehr
Posts: 782
Joined: Sun Jan 27, 2019 3:21 am

Re: Python bug with spinBox_poisson_ratio

Postby uwestoehr » Tue Mar 12, 2019 9:43 am

bernd wrote:
Tue Mar 12, 2019 5:41 am
Which material card did you use to set this?
If I remember correctly it was the card for PET-generic.