UnitUtils.Convert(Double, DisplayUnitType, DisplayUnitType)
Description:
Converts a value from one display unit to another, such as square feet to square meters.
Converts a value from one display unit to another, such as square feet to square meters.
Overloads (2):
Convert(Double,DisplayUnitType,DisplayUnitType)
[ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `Convert(double, ForgeTypeId, ForgeTypeId)` overload instead.")]
public static double Convert(
double value,
DisplayUnitType currentDisplayUnit,
DisplayUnitType desiredDisplayUnit
)
-
DoublevalueThe value to convert.
-
currentDisplayUnitThe current display unit.
-
desiredDisplayUnitThe desired display unit.
Return Value
The converted value.
The converted value.
void SetTopOffset(Wall wall, double dOffsetInches)
{
// convert user-defined offset value to feet from inches prior to setting
double dOffsetFeet = UnitUtils.Convert(dOffsetInches,
DisplayUnitType.DUT_DECIMAL_INCHES,
DisplayUnitType.DUT_DECIMAL_FEET);
Parameter paramTopOffset = wall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET);
paramTopOffset.Set(dOffsetFeet);
}
-
The given value for value is not finite -or- currentDisplayUnit is an invalid display unit. See UnitUtils.IsValidDisplayUnit(DisplayUnitType) and UnitUtils.GetValidDisplayUnits(). -or- desiredDisplayUnit is an invalid display unit. See UnitUtils.IsValidDisplayUnit(DisplayUnitType) and UnitUtils.GetValidDisplayUnits().
-
A value passed for an enumeration argument is not a member of that enumeration
-
currentDisplayUnit and desiredDisplayUnit have different dimensions.
No comments yet. Start the discussion.
Loading…