Units: Difference between revisions

From FreeCAD Documentation
Line 30: Line 30:
== supported units ==
== supported units ==
Here the defined units in FreeCAD so far. It's easy to add an own one. The definition is here[http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Base/UnitsApi.l?view=markup].
Here the defined units in FreeCAD so far. It's easy to add an own one. The definition is here[http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Base/UnitsApi.l?view=markup].

Metric length
"mm" 1.0; // millimeter (internal standard length)
"mm" 1.0; // millimeter (internal standard length)
"m" 1000.0; // meter
"m" 1000.0; // meter
Line 35: Line 37:
"dm" 100.0; // decimeter
"dm" 100.0; // decimeter
"km" 1000000.0; // kilometer
"km" 1000000.0; // kilometer
Imperial lenth
"in" 25.4; // inch
"in" 25.4; // inch
"fo" 304.8; // foot
"fo" 304.8; // foot
"th" 0.0254; // thou
"th" 0.0254; // thou
"yr" 914.4; // yard
"yr" 914.4; // yard
Metric mass
"kg" 1.0; // kilogram (internal standard mass)
"kg" 1.0; // kilogram (internal standard mass)
"g" 0.001; // gram
"g" 0.001; // gram
"mg" 0.000001; // milligram
"mg" 0.000001; // milligram
"t" 1000.0; // ton
"t" 1000.0; // ton
Imperial mass
"lb" 0.45359237; // pound
"lb" 0.45359237; // pound
"oz" 0.45359237; // ounce
"oz" 0.45359237; // ounce
"st" 6.35029318; // Stone
"st" 6.35029318; // Stone
"cwt" 50.80234544;// hundredweights
"cwt" 50.80234544;// hundredweights
Angle
"deg" 1.0; // degree (internal standard angle)
"deg" 1.0; // degree (internal standard angle)
"rad" 180/M_PI; // radian
"rad" 180/M_PI; // radian
"gon" 360.0/400.0;// gon
"gon" 360.0/400.0;// gon
Time
"s" 1.0; // second (internal standard time)
"s" 1.0; // second (internal standard time)
"min" 60.0; // minute
"min" 60.0; // minute
"h" 3600.0; // hour
"h" 3600.0; // hour
Rest of SI
"A" 1.0; // Ampere (internal standard electric current)
"A" 1.0; // Ampere (internal standard electric current)
"K" 1.0; // Kelvin (internal standard thermodynamic temperature)
"K" 1.0; // Kelvin (internal standard thermodynamic temperature)
"cd" 1.0; // Candela (internal standard luminous intensity)
"cd" 1.0; // Candela (internal standard luminous intensity)
"mol" 1.0; // Mole (internal standard amount of substance)
"mol" 1.0; // Mole (internal standard amount of substance)
Metric Volume

"ml" 1000.0; // milliliter (derived standard volume)
"yl" 1.0; // microliter mm^3(derived standard volume)
"ml" 1000.0; // milliliter cm^3
"l" 1000000.0; // Liter dm^3
"l" 1000000.0; // Liter dm^3

Revision as of 11:19, 8 January 2010

Here some reading about units:

Examples

# -- some examples of the FreeCAD unit translation system --
# make a shortcut for the examples
tu = App.translateUnit

# 10 meters in internal numbers
tu('10 m')
# doing math
tu('3/8 in')
# combined stuff
tu('100 km/h')
# transfer to other units
tu('100 km/h')/tu('m/s')
# derived units (Ohm)
tu('m^2*kg*s^-3*A^-2')
# or
tu('(m^2*kg)/(A^2*s^3)')
# angles 
tu('2*pi rad') # full circle
# as gon
tu('2*pi rad') / tu('gon')

supported units

Here the defined units in FreeCAD so far. It's easy to add an own one. The definition is here[1].

Metric length

"mm"    1.0;        // millimeter       (internal standard length)
"m"     1000.0;     // meter
"cm"    10.0;       // centimeter
"dm"    100.0;      // decimeter
"km"    1000000.0;  // kilometer

Imperial lenth

"in"    25.4;       // inch
"fo"    304.8;      // foot
"th"    0.0254;     // thou
"yr"    914.4;      // yard

Metric mass

"kg"    1.0;        // kilogram       (internal standard mass)
"g"     0.001;      // gram
"mg"    0.000001;   // milligram
"t"     1000.0;     // ton 

Imperial mass

"lb"    0.45359237; // pound
"oz"    0.45359237; // ounce
"st"    6.35029318; // Stone
"cwt"   50.80234544;// hundredweights

Angle

"deg"   1.0;        // degree         (internal standard angle)
"rad"   180/M_PI;   // radian         
"gon"   360.0/400.0;// gon         

Time

"s"     1.0;        // second         (internal standard time)
"min"   60.0;       // minute
"h"     3600.0;     // hour  

Rest of SI

"A"     1.0;        // Ampere         (internal standard electric current)
"K"     1.0;        // Kelvin         (internal standard thermodynamic temperature)
"cd"    1.0;        // Candela        (internal standard luminous intensity)        
"mol"   1.0;        // Mole           (internal standard amount of substance)        

Metric Volume

"yl"    1.0;        // microliter mm^3(derived  standard volume)
"ml"    1000.0;     // milliliter cm^3    
"l"     1000000.0;  // Liter      dm^3