GetDefaultFamilyTypeId Method


Gets the default family type id with the given family category id.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2015

Syntax

C#
public ElementId GetDefaultFamilyTypeId(
	ElementId familyCategoryId
)
Visual Basic
Public Function GetDefaultFamilyTypeId ( _
	familyCategoryId As ElementId _
) As ElementId
Visual C++
public:
ElementId^ GetDefaultFamilyTypeId(
	ElementId^ familyCategoryId
)

Parameters

familyCategoryId
Type: Autodesk.Revit.DBElementId
The family category id.

Return Value

The default family type id.

Examples

CopyC#
private void AssignDefaultTypeToColumn(Document document, FamilyInstance column)
{
    ElementId defaultTypeId = document.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralColumns));

    if (defaultTypeId != ElementId.InvalidElementId)
    {
        FamilySymbol defaultType = document.GetElement(defaultTypeId) as FamilySymbol;
        if (defaultType != null)
        {
            column.Symbol = defaultType;
        }
    }
}
CopyVB.NET
Private Sub AssignDefaultTypeToColumn(document As Document, column As FamilyInstance)
   Dim defaultTypeId As ElementId = document.GetDefaultFamilyTypeId(New ElementId(BuiltInCategory.OST_StructuralColumns))

   If defaultTypeId <> ElementId.InvalidElementId Then
      Dim defaultType As FamilySymbol = TryCast(document.GetElement(defaultTypeId), FamilySymbol)
      If defaultType IsNot Nothing Then
         column.Symbol = defaultType
      End If
   End If
End Sub

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

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 →