Revit 2025 API
Unit |
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 )
Public Shared Function Convert ( value As Double, currentUnitTypeId As ForgeTypeId, desiredUnitTypeId As ForgeTypeId ) As Double
public: static double Convert( double value, ForgeTypeId^ currentUnitTypeId, ForgeTypeId^ desiredUnitTypeId )
static member Convert : value : float * currentUnitTypeId : ForgeTypeId * desiredUnitTypeId : ForgeTypeId -> float
Parameters
- value Double
- The value to convert.
- currentUnitTypeId ForgeTypeId
- Identifier of the current unit.
- desiredUnitTypeId ForgeTypeId
- Identifier of the desired unit.
Return Value
DoubleThe converted value.

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