Units

From LabRPS Documentation
Revision as of 12:48, 29 October 2024 by LabRPS (talk | contribs) (Created page with "{{TOCright}} Some reading about units: *[http://en.wikipedia.org/wiki/Metrology Metrology] *[http://en.wikipedia.org/wiki/International_System_of_Units SI system] *[http://en.wikipedia.org/wiki/Imperial_units Imperial units] *[http://en.wikipedia.org/wiki/SI_derived_unit SI derived units] *[http://en.wikipedia.org/wiki/Degree_%28angle%29 angle units] *[https://github.com/3drepo/occt/blob/master/src/UnitsAPI/Units.dat unit implemented in OCC] == Examples == {{Code|cod...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Some reading about units:

Examples

# -- some examples of the LabRPS unit translation system --
# make a shortcut for the examples
pq = LabRPS.Units.parseQuantity

# 10 meters in internal numbers
pq('10 m')

# doing math
pq('3/8 in')

# combined stuff
pq('100 km/h')

# transfer to other units
pq('100 km/h')/tu('m/s')

# derived units (Ohm)
pq('m^2*kg*s^-3*A^-2')

# or
pq('(m^2*kg)/(A^2*s^3)')

# angles 
pq('2*pi rad') # full circle

# as gon
pq('2*pi rad') / tu('gon')

# more imperial
tu('1ft (3+7/16)in')

# or 
pq('1\' (3+7/16)"') # the ' we have to escape because of python

# trigonometry
pq('sin(pi)')

Supported units

A complete list of all supported units can be found here.

See Also