Converts a value from one unit to another, such as square feet to square meters.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
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
| 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.
|
See Also
Reference