[Fixed]Can not set material: "Not known problem"

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Can not set material: "Not known problem"

Post by bernd »

seams we need werner ...
wmayer wrote: ping
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Can not set material: "Not known problem"

Post by wmayer »

Something must be wrong with the Quantity grammar file.

Here is a code snippet which can be reproduced independent of any user preferences:

Code: Select all

from FreeCAD import Units
param_value = Units.Quantity('0.0001 m/m/K')
param_value.getValueAs("1/K") # fails
param_value.getValueAs("m/m/K") # works
param_value.getValueAs("1 1/K") # works
param_value.getValueAs("K^-1") # works
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Can not set material: "Not known problem"

Post by reox »

Is it possible, that the problem is, that quantity is defined as "num unit"?
I would suspect, that the parser sees the "1" as num and "/K" as unit - even though "one / unit" is defined.
I'm no yacc pro though ;)
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Can not set material: "Not known problem"

Post by wmayer »

reox wrote: Sat Nov 02, 2019 1:37 pm Is it possible, that the problem is, that quantity is defined as "num unit"?
I would suspect, that the parser sees the "1" as num and "/K" as unit - even though "one / unit" is defined.
I'm no yacc pro though ;)
I am not an expert either but the line

Code: Select all

|   ONE '/' unit                { $$ = Quantity(1.0)/$3;  	        }
appears underneath the unit section while for the quantity section it's only the line:

Code: Select all

num unit                    { $$ = $1*$2;    	                }
Maybe the above line must be copied to the quantity section. But what's weird is when I try

Code: Select all

FreeCAD.Units.Unit("1 / K")
In this case an error dialog pops up due to an unhandled exception.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Can not set material: "Not known problem"

Post by wmayer »

reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Can not set material: "Not known problem"

Post by reox »

wmayer wrote: Sun Nov 03, 2019 5:48 pm git commit 0b47fb6de
yes, that fixed it for me! It seems to work now in other unit systems as well. Thanks a lot!
Post Reply