Could use support for engineering decimal units

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

We're making good progress on the output side:
CivilUnits2.png
CivilUnits2.png (27.11 KiB) Viewed 1323 times
CivilUnits3.png
CivilUnits3.png (21.35 KiB) Viewed 1323 times
But there are problems on the input side. The expression parser (??) doesn't like degrees + feet(') + inches("). If I try to enter an Angular constraint (say 60*24'10") I get 1.0 back as a value. Need to do some digging.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Post by Joel_graff »

wandererfan wrote: Tue Dec 04, 2018 1:14 am But there are problems on the input side. The expression parser (??) doesn't like degrees + feet(') + inches("). If I try to enter an Angular constraint (say 60*24'10") I get 1.0 back as a value. Need to do some digging.
That looks awesome. No idea what to suggest regarding the expression parser, unless we replace the ' and " with 'm' and 's', or something...

Still, thanks for the effort. It looks really good!
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

Joel_graff wrote: Tue Dec 04, 2018 4:40 am No idea what to suggest regarding the expression parser, unless we replace the ' and " with 'm' and 's', or something...
l/c 'm' is taken for metres, l/c 's' is taken for seconds(time), so I'm going with 'M' & 'S' for now. We're definitely getting closer:
AngleDataEntry.png
AngleDataEntry.png (16.77 KiB) Viewed 1280 times

Seconds are displayed using the global decimal place setting. Do you need decimal place on Seconds? Looks ugly to me, but that's just aesthetics, not functionality.
FracSeonds.png
FracSeonds.png (11.74 KiB) Viewed 1280 times
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Post by Joel_graff »

wandererfan wrote: Wed Dec 05, 2018 2:52 pm Seconds are displayed using the global decimal place setting. Do you need decimal place on Seconds? Looks ugly to me, but that's just aesthetics, not functionality.
For design purposes, the nearest second should be sufficient - we don't design to any greater precision than that. Fractions of seconds are more of a concern in surveying contexts, though having the ability may eventually be necessary. The nearest half-second (tenth) might make for a good compromise, there.

As for the notation, I'm absolutely fine with it for development, but in a production design environment, it wouldn't be acceptable. That said, it may be useful to consider a feature request to allow for repurposing unit symbology. No doubt some unpleasant abstraction would be in order to make that happen... :/ Anyway, kinda hard to ask for that, though, unless I knew it would be a benefit somewhere else, since it's absolutely not an issue for what I'm doing.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

Joel_graff wrote: Wed Dec 05, 2018 6:43 pm For design purposes, the nearest second should be sufficient - we don't design to any greater precision than that.
I'm going with integer seconds and "M"/"S" for data entry. If we need decimals on the seconds someday we can change it then.

Degrees can be "deg" or "°".

TechDraw has been modified to display dd°mm'ss", but it doesn't have to handle data entry. It might be possible to display with proper symbols in Sketcher (or other workbenches) too, but I'll have to look into it.

We're stuck with M&S for data entry for the near future. The Unit system expects each symbol to belong to 1 unit. Changing that looks like a big job from here.

wf
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Post by Joel_graff »

wandererfan wrote: Thu Dec 06, 2018 12:50 am We're stuck with M&S for data entry for the near future. The Unit system expects each symbol to belong to 1 unit. Changing that looks like a big job from here.
Yeah, I had a funny feeling that was the case - I've dealt with issues like that before in other projects... I know how ugly it can get.

That said, having a unit system that's user-customizable seems like something that should be in a long-term plan, if nothing else.

There's a lot of legacy unit conventions out there still in use, many of which borrow from others, and the differences can be subtle or significant... In fact, it wasn't so long ago that US surveyors still used units of 'rods' and 'chains' (I suspect there's still a few applications out there that use them). So a way to allow for creating unique / niche unit systems local to a workbench (or, more sensibly, a document), and a way to re-use symbols across (or even within) unit systems seems like a valuable feature to me.

Well, crap. Now I'm interested in solving this problem. :roll:
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

Joel_graff wrote: Thu Dec 06, 2018 1:52 pm Well, crap. Now I'm interested in solving this problem. :roll:
:D :D "If you want anything done, ask a busy man."
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Post by Joel_graff »

wandererfan wrote: Thu Dec 06, 2018 3:02 pm "If you want anything done, ask a busy man."
:lol:

Can you point me to the code? I really can't commit to dealing with it, but I'm curious... which has to count for something. If nothing else, understanding the size and scale of the needed solution might convince me just to keep my mouth shut. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

Joel_graff wrote: Thu Dec 06, 2018 3:05 pm Can you point me to the code?
The easy part is creating a new Unit Schema. That happens in "src/Base/UnitsSchemaImperial1.*"

The hard part is making the new schema valid for input fields. That happens in "src/Base/Quantity*.*". There is a formal grammar set up with a lexer and parser that generate code to interpret your schema. flex and bison are the tools involved.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Could use support for engineering decimal units

Post by wandererfan »

git commit 00e6e376c9 and git commit 99074228.

In today's FreeCAD-daily.
Post Reply