UnitUtils.Convert
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.
public static double Convert(
double value,
DisplayUnitType currentDisplayUnit,
DisplayUnitType desiredDisplayUnit
)
-
valueThe 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.