Formats a number with units into a string based on the units formatting settings for a document.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2013
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- document
- Type: Autodesk.Revit.DB Document
The document whose Units object will be used for the units formatting settings.
- unitType
- Type: Autodesk.Revit.DB UnitType
The unit type of the value to format.
- value
- Type: System Double
The value to format, in Revit's internal units.
Return Value
The formatted string.Remarks
For additional formatting options, see UnitFormatUtils.Format() This method is equivalent to calling UnitFormatUtils.Format() with the Units object obtained from Document.GetUnits() and with maxAccuracy and forEditing set to false.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions ArgumentException | unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes(). -or- The given value for value is not finite |
Autodesk.Revit.Exceptions ArgumentNullException | A non-optional argument was NULL |
Autodesk.Revit.Exceptions ArgumentOutOfRangeException | A value passed for an enumeration argument is not a member of that enumeration |
Autodesk.Revit.Exceptions InvalidOperationException | The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). |