UnitSet.convertToSI


convertToSI(value, energyDim, forceDim, lengthDim, massDim, timeDim, temperatureDim, [perLengthDim])

Modify the first argument (which is assumed to be given in the same units as this object) such that its value is given in SI (J,N,m,kg,s,C) The other arguments indicate the dimensionality of the value. For example, an acceleration has exponent 1 of length, and exponent -2 of time. In combination with convertFromSI, this function can be used to convert any value from any unit system to any other unit system. Whilst energy and force can be derived from the other four dimensions, they are included for convenience.

valuevariant value to modify
energyDimintegerexponent of energy
forceDimintegerexponent of force
lengthDimintegerexponent of length
massDimintegerexponent of mass
timeDimintegerexponent of time
temperatureDimintegerexponent of temperature
perLengthDimoptional integer 0 (the default) for most quantities. 1 for quantities that are 'per unit length', such as "mm˛/m". Similarly 2 and 3 for quantities that are per unit area or volume.
Return valuenone 

Example

To convert 25.4mm into inches


 dist = 25.4
 call getUnitSet("N,mm,t,s,C").convertToSI(dist, 0, 0, 1, 0, 0, 0)
 call msgbox(dist) ' will show 0.0254
 call getUnitSet("lbf,in,slinch,s,F").convertFromSI(dist, 0, 0, 1, 0, 0, 0)
 call msgbox(dist) ' will show (approx) 1.0
 

Back to UnitSet

Back to Overview