FormatOptions
Options for formatting numbers with units.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.FormatOptions
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class FormatOptions : IDisposable
The FormatOptions type exposes the following members.
Constructors
Name
Description
Public Method
FormatOptions.
Creates a new FormatOptions object that represents default formatting.
Public Method
FormatOptions(ForgeTypeId)
Creates a new FormatOptions object that represents custom formatting.
Public Method
FormatOptions(FormatOptions)
Creates a copy of a FormatOptions object.
Public Method
FormatOptions(ForgeTypeId, ForgeTypeId)
Creates a new FormatOptions object that represents custom formatting.
Properties
Name
Description
Public Property
Accuracy
The accuracy to which values will be rounded.
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Public Property
RoundingMethod
The method used to round values: round to nearest, round up, or round down.
Public Property
SuppressLeadingZeros
Indicates if leading zeros should be suppressed in feet and fractional inches.
Public Property
SuppressSpaces
Indicates if spaces around the dash should be suppressed in feet and fractional inches.
Public Property
SuppressTrailingZeros
Indicates if trailing zeros after the decimal point should be suppressed.
Public Property
UseDefault
Indicates whether default or custom formatting should be used.
Public Property
UseDigitGrouping
Indicates if digit grouping symbols should be displayed.
Public Property
UsePlusPrefix
Indicates if a plus sign prefix should be displayed for positive and zero values.
Methods
Name
Description
Public Method
CanHaveSymbol.
Checks whether a symbol can be specified to display the unit in this FormatOptions.
Public Method
Static Member
CanHaveSymbol(ForgeTypeId)
Checks whether a symbol can be specified to display a given unit.
Public Method
CanSuppressLeadingZeros.
Checks whether leading zeros can be suppressed for the display unit in this FormatOptions.
Public Method
Static Member
CanSuppressLeadingZeros(ForgeTypeId)
Checks whether leading zeros can be suppressed for a given unit.
Public Method
CanSuppressSpaces.
Checks whether spaces can be suppressed for the display unit in this FormatOptions.
Public Method
Static Member
CanSuppressSpaces(ForgeTypeId)
Checks whether spaces can be suppressed for a given unit.
Public Method
CanSuppressTrailingZeros.
Checks whether trailing zeros can be suppressed for the display unit in this FormatOptions.
Public Method
Static Member
CanSuppressTrailingZeros(ForgeTypeId)
Checks whether trailing zeros can be suppressed for a given unit.
Public Method
CanUsePlusPrefix.
Checks whether a plus prefix can be displayed for the display unit in this FormatOptions.
Public Method
Static Member
CanUsePlusPrefix(ForgeTypeId)
Checks whether a plus prefix can be displayed for a given unit.
Public Method
Dispose
Releases all resources used by the FormatOptions
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetSymbolTypeId
Gets the identifier of the symbol indicating the unit quantifying the value.
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
GetUnitTypeId
Gets the identifier of the unit used to quantify values.
Public Method
GetValidSymbols.
Gets the identifiers of all valid symbols for the unit in this FormatOptions.
Public Method
Static Member
GetValidSymbols(ForgeTypeId)
Gets the identifiers of all valid symbols for a given unit.
Public Method
IsValidAccuracy(Double)
Checks whether an accuracy is valid for the display unit in this FormatOptions.
Public Method
Static Member
IsValidAccuracy(ForgeTypeId, Double)
Checks whether an accuracy is valid for a given unit.
Public Method
IsValidForSpec
Checks whether this FormatOptions is valid for a given spec.
Public Method
IsValidSymbol(ForgeTypeId)
Checks whether a symbol is valid for the unit in this FormatOptions.
Public Method
Static Member
IsValidSymbol(ForgeTypeId, ForgeTypeId)
Checks whether a symbol is valid for a given unit.
Public Method
SetSymbolTypeId
Sets the symbol that should be displayed to indicate the unit quantifying the value.
Public Method
SetUnitTypeId
Sets the unit used to quantify values.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Remarks
The FormatOptions class contains settings that control how to format numbers with units as strings. It contains those settings that are typically chosen by an end user in the Format dialog and stored in the document.
The FormatOptions class is used in two different ways. A FormatOptions object in the Units class represents the default settings for the document. A FormatOptions object used elsewhere represents settings that may optionally override the default settings.
The UseDefault property controls whether a FormatOptions object represents default or custom formatting. If UseDefault is true, formatting will be according to the default settings in the Units class, and none of the other settings in the object are meaningful. If UseDefault is false, the object contains custom settings that override the default settings in the Units class. UseDefault is always false for FormatOptions objects in the Units class.