missing units in value expression parser

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!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

missing units in value expression parser

Post by uwestoehr »

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

Re: missing units in value expression parser

Post by bernd »

[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
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: missing units in value expression parser

Post by uwestoehr »

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

Re: missing units in value expression parser

Post by bernd »

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

Re: missing units in value expression parser

Post by bernd »

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

Re: missing units in value expression parser

Post by bernd »

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
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: missing units in value expression parser

Post by uwestoehr »

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
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: missing units in value expression parser

Post by uwestoehr »

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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: missing units in value expression parser

Post by Kunda1 »

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 :)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: missing units in value expression parser

Post by uwestoehr »

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