IsValidUnitType Method


Checks whether a unit type is valid.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2014

Syntax

C#
[ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `IsSpec(ForgeTypeId)` method instead.")]
public static bool IsValidUnitType(
	UnitType unitTypeEnum
)
Visual Basic
<ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `IsSpec(ForgeTypeId)` method instead.")> _
Public Shared Function IsValidUnitType ( _
	unitTypeEnum As UnitType _
) As Boolean
Visual C++
[ObsoleteAttribute(L"This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `IsSpec(ForgeTypeId)` method instead.")]
public:
static bool IsValidUnitType(
	UnitType unitTypeEnum
)

Parameters

unitTypeEnum
Type: Autodesk.Revit.DB UnitType
The unit type to check.

Return Value

True if the unit type is valid, false otherwise.

Remarks

A unit type is considered valid if it is an actual unit type like UT_Length or UT_Angle. Obsolete values and the special values UT_Custom and UT_Undefined are not considered valid.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →