RVTDocs.com
Namespace: Autodesk.Revit.DB Class: UnitUtils

UnitUtils.Convert

Method
Description:
Converts a value from one unit to another, such as square feet to square meters.
Syntax
public static double Convert(
	double value,
	ForgeTypeId currentUnitTypeId,
	ForgeTypeId desiredUnitTypeId
)
Parameters
Parameter Type Description
value Double The value to convert.
currentUnitTypeId ForgeTypeId Identifier of the current unit.
desiredUnitTypeId ForgeTypeId Identifier of the desired unit.
Return Value
Type Description
Double The converted value.
Exceptions
Exception Condition
ArgumentException The given value for value is not finite -or- currentUnitTypeId is not a unit identifier. See UnitUtils.IsUnit(ForgeTypeId) and UnitUtils.GetUnitTypeId(DisplayUnitType). -or- desiredUnitTypeId is not a unit identifier. See UnitUtils.IsUnit(ForgeTypeId) and UnitUtils.GetUnitTypeId(DisplayUnitType).
ArgumentNullException A non-optional argument was null
ArgumentsInconsistentException currentUnitTypeId and desiredUnitTypeId have different dimensions.