Document.GetDefaultFamilyTypeId Method

DocumentGetDefaultFamilyTypeId Method

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

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public ElementId GetDefaultFamilyTypeId(
	ElementId familyCategoryId
)
Public Function GetDefaultFamilyTypeId ( 
	familyCategoryId As ElementId
) As ElementId
public:
ElementId^ GetDefaultFamilyTypeId(
	ElementId^ familyCategoryId
)
member GetDefaultFamilyTypeId : 
        familyCategoryId : ElementId -> ElementId 

Parameters

familyCategoryId  ElementId
The family category id.

Return Value

ElementId
The default family type id.
Exceptions
ExceptionCondition
ArgumentNullException A non-optional argument was null
Example
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;
        }
    }
}
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

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also