UnitUtilsConvert Method

Converts a value from one unit to another, such as square feet to square meters.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static double Convert(
	double value,
	ForgeTypeId currentUnitTypeId,
	ForgeTypeId desiredUnitTypeId
)

Parameters

value  Double
The value to convert.
currentUnitTypeId  ForgeTypeId
Identifier of the current unit.
desiredUnitTypeId  ForgeTypeId
Identifier of the desired unit.

Return Value

Double
The converted value.
Exceptions
ExceptionCondition
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.
See Also