UnitUtils.ConvertFromInternalUnits
Description:
Converts a value from Revit's internal units to a given display unit.
Converts a value from Revit's internal units to a given display unit.
public static double ConvertFromInternalUnits(
double value,
DisplayUnitType displayUnit
)
-
valueThe value to convert.
-
displayUnitThe desired display unit.
Return Value
The converted value.
The converted value.
double GetYieldStressInKsi(Material material)
{
double minYieldStress = 0;
// Get the structural asset for the material
ElementId strucAssetId = material.StructuralAssetId;
if (strucAssetId != ElementId.InvalidElementId)
{
PropertySetElement pse = material.Document.GetElement(strucAssetId) as PropertySetElement;
if (pse != null)
{
StructuralAsset asset = pse.GetStructuralAsset();
// Get the min yield stress and convert to ksi
double minYieldStressInRevitUnits = asset.MinimumYieldStress;
minYieldStress = UnitUtils.ConvertFromInternalUnits(minYieldStressInRevitUnits,
DisplayUnitType.DUT_KIPS_PER_SQUARE_INCH);
}
}
return minYieldStress;
}
-
The given value for value is not finite -or- displayUnit 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