Sweet!wandererfan wrote: ↑Fri Dec 07, 2018 1:11 pm git commit 00e6e376c9 and git commit 99074228.
In today's FreeCAD-daily.
Could use support for engineering decimal units
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Could use support for engineering decimal units
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Could use support for engineering decimal units
So I've set the document units to Imperial Civil and tried entering an angle, but it defaults to decimal degrees. The FPO property is App::PropertyAngle...wandererfan wrote: ↑Wed Dec 05, 2018 2:52 pm 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:
...
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.
Am I missing something?
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Could use support for engineering decimal units
It appears the PropertyEditor data entry field for angles doesn't know about Units. The degree sign is hard coded.Joel_graff wrote: ↑Tue Dec 11, 2018 9:20 pm So I've set the document units to Imperial Civil and tried entering an angle, but it defaults to decimal degrees. The FPO property is App::PropertyAngle...
Am I missing something?
Might take me a bit to figure this out.
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Could use support for engineering decimal units
Created issue #3726 so this doesn't get lost.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Could use support for engineering decimal units
Ok, thanks.wandererfan wrote: ↑Wed Dec 12, 2018 1:01 am It appears the PropertyEditor data entry field for angles doesn't know about Units. The degree sign is hard coded.
Might take me a bit to figure this out
On the unit symbology note, I started poking through the Quantity / UnitSchema code just to get acquainted... The lexer / parser stuff is entirely foreign to me (I'm still having nightmares from coding a parser in Boost several years ago), but I feel like the solution lies in providing a 'context' for quantities so that quantity units (names / symbols) only need be unique within that context.
Examine DMS angles. It's immediate 'context' is an angular measurement (alongside decimal degrees and radians). But, DMS units also use a temporal quantity's units (minutes / seconds), and denotes them with symbols that are associated with a length quantity! I suppose it's a bit of an edge case, but I suspect accommodating this would probably deal with a lot of other potential unit symbol / name collisions as well.
So, maybe a single layer of abstraction is in order to help fix this? That is, we add a "quantity context" class that subclasses Quantity, and the specific unit-quantity class then derives from the context class. Thus, Quantity::Foot becomes Quantity::Length::Foot.
But I don't know if that's really necessary, because I see that in QuantityParser.l, there's a series of lambda's or functions that are defined, beginning with the unit symbol as a string token:
Code: Select all
"M" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
"S" yylval = Quantity::AngSecond; return UNIT; // second(Angular)
For example to re-use the foot symbol for angular minutes:
Code: Select all
"Angle::'" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
Code: Select all
"Unit_id_here" "'" yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Could use support for engineering decimal units
Yeah, I was thinking of "context" as a way to distinguish 'minutes from 'feet. Should be able to figure it out from the type of unit length/feet, angle/minutes. But I didn't get into it very far.Joel_graff wrote: ↑Wed Dec 12, 2018 1:54 pm The lexer / parser stuff is entirely foreign to me (I'm still having nightmares from coding a parser in Boost several years ago), but I feel like the solution lies in providing a 'context' for quantities so that quantity units (names / symbols) only need be unique within that context.
Anyway, found a fix for the property editor: but Expressions with dms don't parse, so I'll have to learn a bit about that area.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Could use support for engineering decimal units
Ok. If you get some time to think about the problem a bit more, keep me updated - it'll give me a chance to learn something and maybe help out a bit.wandererfan wrote: ↑Wed Dec 12, 2018 4:01 pm Yeah, I was thinking of "context" as a way to distinguish 'minutes from 'feet. Should be able to figure it out from the type of unit length/feet, angle/minutes. But I didn't get into it very far.
Just like fixing up an old house... Every improvement exposes more problems!wandererfan wrote: ↑Wed Dec 12, 2018 4:01 pm but Expressions with dms don't parse, so I'll have to learn a bit about that area.
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Could use support for engineering decimal units
According to this https://en.wikipedia.org/wiki/Minute_and_second_of_arc, the proper symbols for arcminute and arcsecond are:
- ′ ′ ′ prime symbol for minutes (no key for ′ Shift+Ctl+u 2032)
- ″ ″ ″ double prime symbol for secs (no key for ″ Shift+Ctl+u 2033)
and apostrophe and quotation mark are substitutes.
How do you feel about using those as unique display symbols for ddmmss angle measurement?
We'd need to keep M&S for data entry(?) like we have "deg" as a data entry substitute for
- ° degree symbol (no key for ° Shift+Ctl+u 00b0)
or teach the world how to enter unicode from the keyboard.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Could use support for engineering decimal units
Hmmm.. The wikipedia article provides a nice dodge to the issue, I'll hand you that. Anyway, I'm fine with that.wandererfan wrote: ↑Fri Dec 14, 2018 1:58 pm How do you feel about using those as unique display symbols for ddmmss angle measurement?
We'd need to keep M&S for data entry(?) like we have "deg" as a data entry substitute for
- ° degree symbol (no key for ° Shift+Ctl+u 00b0)
or teach the world how to enter unicode from the keyboard.
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
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers