Python bug with spinBox_poisson_ratio

A forum to discuss the implementation of a good Materials system in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Python bug with spinBox_poisson_ratio

Post by uwestoehr »

to reproduce:

- open this example file:
Flaschexxx.FCStd
(168.78 KiB) Downloaded 177 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
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Python bug with spinBox_poisson_ratio

Post by bernd »

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
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Python bug with spinBox_poisson_ratio

Post by bernd »

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

Re: Python bug with spinBox_poisson_ratio

Post by bernd »

@Uwe:

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

Re: Python bug with spinBox_poisson_ratio

Post by uwestoehr »

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.
Post Reply