missing units in value expression parser

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

missing units in value expression parser

Postby uwestoehr » Fri Jun 21, 2019 3:32 am

For simulations it is useful if one could use the unit that is commonly used in the sciences field one is working in. FreeCAD supports interestingly units I have never heard of but missed very basic units like Volt.

I described the currently supported units and also created a table with units I miss:
https://www.freecadweb.org/wiki/Expressions#Units

Please review them and if you say a certain unit will not be implemented I will remove it from the list. For the remaining units I would open an enhancement request.
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: missing units in value expression parser

Postby bernd » Sun Jun 23, 2019 8:45 pm

[wikisection][/wikisection]Have you read Units FreeCAD supports any unit which can be made from the seven base units. More about the metric unit system https://en.m.wikipedia.org/wiki/Metric_system

Adding a new unit is not difficault.
User avatar
uwestoehr
Posts: 780
Joined: Sun Jan 27, 2019 3:21 am

Re: missing units in value expression parser

Postby uwestoehr » Mon Jun 24, 2019 2:17 pm

bernd wrote:
Sun Jun 23, 2019 8:45 pm
[wikisection][/wikisection]Have you read Units FreeCAD supports any unit which can be made from the seven base units.
Well, the wiki page seems to be outdated. it links to non-existing pages etc. However, the point is that FC's reality is that there are a lot of weird units defined (e.g. "Stone") while very common units like the Volt is not. There is also an inconsistency of that e.g. km is supported while kJ is not.

As I read the comments in the forum, users like to use the common units of their working field. So despite candela is the base unit, people like to use lumen instead of cd*sr.

I opened this thread to collect what should be supported and what not. I also opened the thread to overcome the inconsistencies. I think the best solution for the latter is, that the parser connects a "k" with the following sequence - if this sequence is a known one. Then it would no longer necessary to add explicit definitions for the most used amount prefixes (n, µ/mu, m, k, M, G) in combinations with all units. I mean Volt is not a base unit but a very common one. And of course there are people needing mV, others need kV.

What do you think about this proposal?
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: missing units in value expression parser

Postby bernd » Mon Jun 24, 2019 3:04 pm

There seams a simple reason for this, only the units which are used somewhwere in FreeCAD are implemented. If it is not implemented noone has needed the unit volt somewhere in FreeCAD. I only have added the units we really need in FEM or in the material editor.
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: missing units in value expression parser

Postby bernd » Mon Jun 24, 2019 3:09 pm

In the regard of this n, m, c, d, k ... this seams reasonable make this available to all units without the nedd to define it for every unit. But needs someone with knowledge of the internals of FreeCAD Unit system who has time and interest to implement this.
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: missing units in value expression parser

Postby bernd » Mon Jun 24, 2019 3:10 pm

BTW: do you need volt somewhere in FreeCAD or is it just.an example of a well known unit not implemented in FreeCAD.
User avatar
uwestoehr
Posts: 780
Joined: Sun Jan 27, 2019 3:21 am

Re: missing units in value expression parser

Postby uwestoehr » Mon Jun 24, 2019 11:33 pm

bernd wrote:
Mon Jun 24, 2019 3:09 pm
In the regard of this n, m, c, d, k ... this seams reasonable make this available to all units without the need to define it for every unit. But needs someone with knowledge of the internals of FreeCAD Unit system who has time and interest to implement this.
I know. my spare time is too limited and I already promised too many things I could not deliver. So I will open at least an enhancement request that this won't be forgotten.
bernd wrote:
Mon Jun 24, 2019 3:10 pm
BTW: do you need volt somewhere in FreeCAD or is it just.an example of a well known unit not implemented in FreeCAD.
I wanted to use it in the material card dialog. I noticed that is currently only half-implemented. So it is the code but does not yet work. A fix is in my ToDo list.
However, I stumbled over the units issue because of the material card dialog. I wanted to use units that are common in my working field but units like Tesla are not recognized for a electromagnetic simulations. A colleague asked my if he could do such simulations with FreeCAD, thus I played a bit around.
User avatar
uwestoehr
Posts: 780
Joined: Sun Jan 27, 2019 3:21 am

Re: missing units in value expression parser

Postby uwestoehr » Tue Jun 25, 2019 11:38 pm

uwestoehr wrote:
Mon Jun 24, 2019 11:33 pm
So I will open at least an enhancement request that this won't be forgotten.
I did so: issue #4037
User avatar
Kunda1
Posts: 5915
Joined: Thu Jan 05, 2017 9:03 pm

Re: missing units in value expression parser

Postby Kunda1 » Wed Jun 26, 2019 12:06 am

uwestoehr wrote:
Tue Jun 25, 2019 11:38 pm
I did so: issue #4037
@uwestoehr thanks. Do you mind also pre-pending "Ticket #4037 - " to this forum thread
thanks in advance :)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
uwestoehr
Posts: 780
Joined: Sun Jan 27, 2019 3:21 am

Re: missing units in value expression parser

Postby uwestoehr » Wed Jun 26, 2019 7:20 am

Kunda1 wrote:
Wed Jun 26, 2019 12:06 am
@uwestoehr thanks. Do you mind also pre-pending "Ticket #4037 - " to this forum thread
thanks in advance :)
What do you mean? The topic was discussed here before and Bernd maintains the material cards.