Materials dialogue problem
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: Materials dialogue problem
@HoWil: It seems like FreeCAD has no built-in declaration and definition for Unit::VolumeExpansionCoefficient. I still don't understand how the Units system works, but maybe that's why in your example this value doesn't seem to parse at all?
The rest looks like locale issues to me. That's different from what I'm currently working on, but either starting FreeCAD on the command line with `LANG=C FreeCAD` or entering the numbers in the format FreeCAD appears to use should work around that and at the same time confirm it's actually a locale problem.
HTH,
Harald
The rest looks like locale issues to me. That's different from what I'm currently working on, but either starting FreeCAD on the command line with `LANG=C FreeCAD` or entering the numbers in the format FreeCAD appears to use should work around that and at the same time confirm it's actually a locale problem.
HTH,
Harald
Re: Materials dialogue problem
PR for the ThermalConductivity Problem:
https://github.com/FreeCAD/FreeCAD/pull/1032
Turns out this was unrelated to the original issues discussed in this thread. Sorry for hijacking the topic.
https://github.com/FreeCAD/FreeCAD/pull/1032
Turns out this was unrelated to the original issues discussed in this thread. Sorry for hijacking the topic.
Re: Materials dialogue problem
Thanks to harald, The unit problem seams fixed in master https://github.com/FreeCAD/FreeCAD/comm ... 3331870c87
@harald its always a good idea to keep the topic updated of you gone make a PR with a fix
bernd
@harald its always a good idea to keep the topic updated of you gone make a PR with a fix
bernd
Re: Materials dialogue problem
Damn sorry I somehow missed the post before my one ... To much FreeCAD today ...
Re: Materials dialogue problem
Thx, Harald for this explaination.lambda wrote: ↑Tue Oct 10, 2017 9:06 am The rest looks like locale issues to me. That's different from what I'm currently working on, but either starting FreeCAD on the command line with `LANG=C FreeCAD` or entering the numbers in the format FreeCAD appears to use should work around that and at the same time confirm it's actually a locale problem.
But, starting with 'LANG=C' does not resolve the problem, nor using '.' instead or ','.
BR,
HoWil
Re: Materials dialogue problem
That's strange, so I looked into this a bit more and realized a couple of things:
* reading 'man 7 locale' I realized that 'LANG' is not the only environment variable affecting locales. There is also LC_* - please try 'env | grep LC' to see if any of those are present on your system.
* maybe also FreeCAD itself sets some locale information, so I tested your examples in a clean sandbox starting with a new document. See below for results. Unfortunately I can't save pictures - FreeCAD always tells me "Can't save null image", so a textual description will need to suffice. (Though if anybody nows how to fix this, please tell me!)
* in 'C' locale FreeCAD uses only '.' not ',' and any locale issues are gone. For example Density now work ok!
* however there appears to be an issue with precision: Only two digits after the decimal marker are shown and values are stored after closing the dialog with this precision only.
* The KinematicViscosity is displayed in mm^2/s instead of m^2/s, but then stored as m^2/s in the document. Here a huge error happens. - I will have a look if this is a problem in the units system like there had been with ThermalConductivity. (Edit: I don't see anything wrong with handling of m^2/s values when using the units system directly from python. It does produce some unwieldy big values sometimes though.)
* Small values are displayed als '0.00' instead of using scientify notation.
So there seems to be a combination of different problems, not all of which necessarily are bugs.
Here is the output from python. In between the dialog was opened and closed again:
Code: Select all
>>> App.ActiveDocument.FluidMaterial.Material
{'Name': u'Air', 'Density': u'1.2 kg/m^3', 'MolarMass': u'28.965', 'KinematicViscosity': u'15.11 m^2/s', 'ThermalExpansionCoefficient': u'0 um/m/K', 'SpecificHeat': u'1.005 J/kg/K', 'VolumetricThermalExpansionCoefficient': u'3.43e-3 m/m/K', 'DynamicViscosity': u'1.80e-5 kg/m/s', 'ThermalConductivity': u'0.0257 W/m/K', 'PrandtlNumber': u'0.7', 'Description': u'Standard air properties at 20 Degrees Celsius and 1 atm'}
>>> App.ActiveDocument.FluidMaterial.Material
{'Name': u'Air', 'Density': u'1.2 kg/m^3', 'MolarMass': u'28.965', 'KinematicViscosity': u'1000.0 m^2/s', 'ThermalExpansionCoefficient': u'0 um/m/K', 'SpecificHeat': u'1.0 J/kg/K', 'VolumetricThermalExpansionCoefficient': u'3.43e-3 m/m/K', 'DynamicViscosity': u'1.80e-5 kg/m/s', 'ThermalConductivity': u'0.03 W/m/K', 'PrandtlNumber': u'0.7', 'Description': u'Standard air properties at 20 Degrees Celsius and 1 atm'}
Re: Materials dialogue problem
What d
Some time ago there were similar problems and IIRC the locale comes from Qt, which possibly does not respect the LC variable.
Currently FreeCAD has a problem here, but you can still make a regular screenshot
When you start FreeCAD with this environment variable set, what does your FreeCAD info says? In the last line it tells you about the locale from FreeCAD's point of view.
Some time ago there were similar problems and IIRC the locale comes from Qt, which possibly does not respect the LC variable.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Materials dialogue problem
I get :chrisb wrote: ↑Sat Oct 14, 2017 5:01 pm When you start FreeCAD with this environment variable set, what does your FreeCAD info says? In the last line it tells you about the locale from FreeCAD's point of view.
Some time ago there were similar problems and IIRC the locale comes from Qt, which possibly does not respect the LC variable.
OS: Ubuntu 16.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12372 (Git)
Build type: None
Branch: master
Hash: 76eba3a57904899805f683e1eaf0cbb71b806c83
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: C/Default (C)
Re: Materials dialogue problem
So we know that FreeCAD respects the environment variable. Which leaves us puzzled with the rest.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Materials dialogue problem
Hello,
I think I could fix the problem concerning the restoring of quantity-based values.
As described by oliveroxtoby, the values are stored in 'C' locale in e.g. Material-db but have to be converted to the user's locale.
For additional information please see https://forum.freecadweb.org/viewtopic. ... 1a#p189664
I did change all parts in '_TaskPanelFemMaterial.py' accordingly. Here for example the part for Density:
Can you (@lambda, @chrisb, @Bernd) please double-check this so Bend can put it in master.
Please see https://github.com/HoWilgh/FreeCAD/comm ... 929be3158e .
BR,
HoWil
I think I could fix the problem concerning the restoring of quantity-based values.
As described by oliveroxtoby, the values are stored in 'C' locale in e.g. Material-db but have to be converted to the user's locale.
For additional information please see https://forum.freecadweb.org/viewtopic. ... 1a#p189664
I did change all parts in '_TaskPanelFemMaterial.py' accordingly. Here for example the part for Density:
Code: Select all
if 'Density' in matmap:
density_new_unit = "kg/m^3"
density = FreeCAD.Units.Quantity(matmap['Density'])
density_with_new_unit = density.getValueAs(density_new_unit)
#self.form.input_fd_density.setText("{} {}".format(density_with_new_unit, density_new_unit))
q = FreeCAD.Units.Quantity("{} {}".format(density_with_new_unit, density_new_unit))
self.form.input_fd_density.setText(q.UserString)
Please see https://github.com/HoWilgh/FreeCAD/comm ... 929be3158e .
BR,
HoWil