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

About the development of the FEM module/workbench.

Moderator: bernd

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

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

Postby bernd » Fri Nov 01, 2019 9:23 pm

seams we need werner ...
wmayer wrote: ping
wmayer
Site Admin
Posts: 15000
Joined: Thu Feb 19, 2009 10:32 am

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

Postby wmayer » Sat Nov 02, 2019 12:58 pm

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: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

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

Postby reox » 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 ;)
wmayer
Site Admin
Posts: 15000
Joined: Thu Feb 19, 2009 10:32 am

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

Postby wmayer » Sun Nov 03, 2019 4:07 pm

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
Site Admin
Posts: 15000
Joined: Thu Feb 19, 2009 10:32 am

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

Postby wmayer » Sun Nov 03, 2019 5:48 pm

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

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

Postby reox » Tue Nov 05, 2019 5:47 am

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!