SetFormatOptions Method
Sets the default FormatOptions for a unit type.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 18.0.0.0 (18.0.0.420)
Since:  2014

Syntax

C#
public void SetFormatOptions(
	UnitType unitType,
	FormatOptions options
)
Visual Basic
Public Sub SetFormatOptions ( _
	unitType As UnitType, _
	options As FormatOptions _
)
Visual C++
public:
void SetFormatOptions(
	UnitType unitType, 
	FormatOptions^ options
)

Parameters

unitType
Type: Autodesk.Revit.DB..::..UnitType
The unit type.
options
Type: Autodesk.Revit.DB..::..FormatOptions
The ForrmatOptions.

Remarks

Some unit types have definitions which are automatically derived from other unit types. For example, UT_SheetLength is derived from UT_Length and UT_ForceScale is derived from UT_Force. In such cases, calling SetFormatOptions() for one unit type may have the side effect of changing the FormatOptions for other unit types that depend on it.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentException unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes(). -or- FormatOptions cannot be modified for unitType. See Units.IsModifiableUnitType() and Units.GetModifiableUnitTypes(). -or- UseDefault is true in options. -or- The display unit in options is not a valid display unit for unitType. See UnitUtils.IsValidDisplayUnit(UnitType, DisplayUnitType) and UnitUtils.GetValidDisplayUnits(UnitType). -or- The rounding method in options is not set to Nearest.
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

See Also