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
Joel_graff
Posts: 1550
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Could use support for engineering decimal units

Postby Joel_graff » Sun Nov 25, 2018 2:42 pm

I've been using US Building units to work with transportation engineering, however, it uses fractional inch notation.

I'd like to see support for engineering units with decimal notation. Essentially, take US Buildiing units and disable fractional notations. Call it US Engineering or something... I could use US Customary, but it's default unit of length is inches, not feet.

OR...

How about the ability to create custom unit presets? :) It would require a series of drop downs for each metric (length, volume, area, mass / weight, etc.), and I've no idea what it would take to implement that under the hood, but I imagine it would be useful.
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
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: Could use support for engineering decimal units

Postby damian » Sun Nov 25, 2018 3:55 pm

Hi Joel
A few months ago I was reading the wiki pages of units https://www.freecadweb.org/wiki/Units and quantities https://www.freecadweb.org/wiki/Quantity. Perhaps some answers to your questions are there.
Bye.
wandererfan
Posts: 3091
Joined: Tue Nov 06, 2012 5:42 pm

Re: Could use support for engineering decimal units

Postby wandererfan » Mon Nov 26, 2018 2:25 pm

Joel_graff wrote:
Sun Nov 25, 2018 2:42 pm
I'd like to see support for engineering units with decimal notation.
Is this "feet.dddd" or "feet inch.dddd"?

Always wanted to try making a new unit.
User avatar
Joel_graff
Posts: 1550
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Postby Joel_graff » Mon Nov 26, 2018 7:49 pm

damian wrote:
Sun Nov 25, 2018 3:55 pm
A few months ago I was reading the wiki pages of units https://www.freecadweb.org/wiki/Units and quantities https://www.freecadweb.org/wiki/Quantity. Perhaps some answers to your questions are there.
I poked through it quickly - looks interesting. Will have to look more closely later.
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
Joel_graff
Posts: 1550
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Postby Joel_graff » Mon Nov 26, 2018 7:51 pm

wandererfan wrote:
Mon Nov 26, 2018 2:25 pm
Is this "feet.dddd" or "feet inch.dddd"?

Always wanted to try making a new unit.
feet.dddd would be the format. Basically, in US highway design, everything is measured in feet - length, area, and volume. The metric side of that would be strictly meter.dddd. I didn't look at the SI presets to see if one existed, though.
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
Joel_graff
Posts: 1550
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Postby Joel_graff » Tue Nov 27, 2018 7:15 pm

damian wrote:
Sun Nov 25, 2018 3:55 pm
A few months ago I was reading the wiki pages of units https://www.freecadweb.org/wiki/Units and quantities https://www.freecadweb.org/wiki/Quantity. Perhaps some answers to your questions are there.
Took a closer look. A few of the links from these pages are broken. One pointed to an API for creating user-defined units, which seemed like it might be the solution I need, at least in the interim.
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
wandererfan
Posts: 3091
Joined: Tue Nov 06, 2012 5:42 pm

Re: Could use support for engineering decimal units

Postby wandererfan » Sun Dec 02, 2018 2:20 pm

Joel_graff wrote:
Mon Nov 26, 2018 7:51 pm
feet.dddd would be the format. Basically, in US highway design, everything is measured in feet - length, area, and volume.
Working on decimal foot units:
CivilUnits.png
CivilUnits.png (25.36 KiB) Viewed 392 times
Are these the right units?
Length: "ft"
Area: "ft^2"
Volume: "ft^3"
Mass: "lb"
Pressure: "psi"
Velocity: "ft/sec"
Angle: "°" (grad?)
User avatar
Joel_graff
Posts: 1550
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Could use support for engineering decimal units

Postby Joel_graff » Mon Dec 03, 2018 2:20 pm

wandererfan wrote:
Sun Dec 02, 2018 2:20 pm
Are these the right units?
Length: "ft"
Area: "ft^2"
Volume: "ft^3"
Mass: "lb"
Pressure: "psi"
Velocity: "ft/sec"
Angle: "°" (grad?)
Oh, man. That looks great! For what I need at the moment, it'll work fine.

It occurred to me, though, that maybe I should take the opportunity to spell out what's really needed for a transportation-specific unit system. I didn't want to get deep in the weeds on this until I really had something that made doing it worthwhile, but here goes, anyway. :)

1. Velocity should be MPH, since the only time it's used is to talk about the speed of planes, trains, and automobiles..

2. Mass and volume units vary depending on what's being described, with mass being either lbs or tons, and volume being either cu.ft. or cu.yd. The default foot / pound is certainly fine.

3. We actually measure angles in degrees, minutes, and seconds (DMS), rather than decimal degrees - didn't think of that until just now! I don't know about the metric side, but I don't think we ever used gradians / radians unless it's deep into surveying-specific applications... Anyway, a minute = 1/60th of a degree and a second is 1/3600th of a degree, same concept as time.

4. I could display DMS units as a 3D vector in the properties view, I guess, though it's somewhat inelegant. We use angles primarily as a bearing from true north. The number format is ddd°mm' ss", though that often gets decorated with NE, NW, SE, SW to indicate the quadrant, which keeps the angles in the 0-90 degree range. Thus, 340 degrees would be N70°00'00"W. Likewise, 120 degrees would be S30°00'00"E.

5. We also use of stationing in transportation engineering to describe length / position. A station is really just the distance along an alignment (usually the roadway center line) in feet / meters, but formatted differently. In feet, 1 station = 100 feet. In metric, 1 station = 1,000 meters. The location of everything that exists in a highway construction project between the beginning and ending points is described using stationing.

For example, let's say I'm standing along a highway 10,528.77 feet from the start of a project. In English, I'm 105.2877 stations from the starting point. In metric, it's 3.210 stations. (10528.77 / 3.28 = 3210.00, rounding up).

More commonly I'd refer to the Station proper and say I'm at "Station 105+28.77" or "Station 3+210.00" (I'm a bit sketchy on precision in metric...). In fact, I can use it to locate myself in two dimensions, and I can say I'm at "Station 105+28.77, 20.50' LT". In other words, I'm standing 20.5 feet to the left of the alignment / center line of the road. Note that left (LT) and right (RT) are determined by the direction in which stationing increases along the alignment.

Anyway, sorry for getting so complicated. The conversions aren't complex, it's just a lot of discipline-specific unit notation that's persisted for a couple of centuries that's the hassle...
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
wandererfan
Posts: 3091
Joined: Tue Nov 06, 2012 5:42 pm

Re: Could use support for engineering decimal units

Postby wandererfan » Mon Dec 03, 2018 2:51 pm

Joel_graff wrote:
Mon Dec 03, 2018 2:20 pm
1. Velocity should be MPH, since the only time it's used is to talk about the speed of planes, trains, and automobiles..
<<snip>>
MPH should be easy.

I think mass can be 0-2000 lbs in lbs, >2000 lbs in tons. Don't know how else to get 2 units into 1 scheme.

Don't know how to do DMS yet. Maybe I can figure it out from in/ft/yd scheme. Even less idea how to do compass quadrants at this point.

Not sure what to do about stations. station X +Y ft? Version 1 is likely just feet for distance.

I'll put together what I can figure out, then you can tell me if it is close enough.

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

Re: Could use support for engineering decimal units

Postby Joel_graff » Mon Dec 03, 2018 3:56 pm

wandererfan wrote:
Mon Dec 03, 2018 2:51 pm
MPH should be easy.

I think mass can be 0-2000 lbs in lbs, >2000 lbs in tons. Don't know how else to get 2 units into 1 scheme.

Don't know how to do DMS yet. Maybe I can figure it out from in/ft/yd scheme. Even less idea how to do compass quadrants at this point.

Not sure what to do about stations. station X +Y ft? Version 1 is likely just feet for distance.

I'll put together what I can figure out, then you can tell me if it is close enough.
I wouldn't worry about mass units at the moment - lbs is really fine. lbs/tons and cf/cy usage context-sensitive - the same metric would use different units depending on what's being described, not depending on the total quantity. I think accommodating that requires adding a feature to the unit system to be able to select among different units for a metric via the Python API.

Regarding the DMS units, that's just formatting a string in the text field, which, I would like to think, is a function that comes with QT... Sort of like number formats that you can do in Excel and (I'm assuming) Calc. In which case, specifying the "unit format" or whatever would be another feature to add to the unit system or maybe to FPO properties...?

For example, the property data would be a 3D vector containing the DMS values, and a number format string 'XX°YY'ZZ"' would be passed to the UI control to tell it how to render the data...

The quadrant values (N,S,E,W) could be indicated as a separate 2-character string property with a combobox. That should represent the convention well enough, at least for the time being.

Distance measurements are simply feet, correct. Stations are used for position. The two won't mix like lb / tons might - either a metric is a distance (length), or it's a position (station). Again, I see that as a number format issue that ought to be managed directly by the UI control since it's strictly an aesthetic treatment. Stations aren't really legitimate units unto themselves. And the offset (LT / RT) could be handled as a separate metric.
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