Retrieves or sets a Category object that represents the category or sub category in which the elements ( this family could generate ) reside. 
   Namespace:   Autodesk.Revit.DB  
  Assembly:   RevitAPI  (in RevitAPI.dll) Version: 16.0.0.0 (16.0.0.0) 
Syntax
Remarks
 All category objects can be retrieved from the application by using the Categories property of the Application.Settings object. 
 Examples
 Copy  C#
 Copy  C# public void GetBeamAndColumnSymbols(Document document)
{
   List<FamilySymbol> columnTypes = new List<FamilySymbol>();
   List<FamilySymbol> framingTypes = new List<FamilySymbol>();
    FilteredElementCollector collector = new FilteredElementCollector(document);
    ICollection<Element> elements = collector.OfClass(typeof(Family)).ToElements();
    foreach(Element element in elements)
    {
        Family family = element as Family;
        Category category = family.FamilyCategory;
        if (null != category)
        {
            ISet<ElementId> familySymbolIds = family.GetFamilySymbolIds();
            if ((int)BuiltInCategory.OST_StructuralColumns == category.Id.IntegerValue)
            {
                foreach (ElementId id in familySymbolIds)
                {
                    FamilySymbol symbol = family.Document.GetElement(id) as FamilySymbol;
                    columnTypes.Add(symbol);
                }
            }
            else if ((int)BuiltInCategory.OST_StructuralFraming == category.Id.IntegerValue)
            {
                foreach (ElementId id in familySymbolIds)
                {
                    FamilySymbol symbol = family.Document.GetElement(id) as FamilySymbol;
                    framingTypes.Add(symbol);
                }
            }
        }
    }
    string message = "Column Types: ";
    foreach (FamilySymbol familySymbol in columnTypes)
    {
       message += "\n" + familySymbol.Name;
    }
    TaskDialog.Show("Revit",message);
} Copy  VB.NET
 Copy  VB.NET Public Sub GetBeamAndColumnSymbols(document As Document)
   Dim columnTypes As New System.Collections.Generic.List(Of FamilySymbol)
   Dim framingTypes As New System.Collections.Generic.List(Of FamilySymbol)
   Dim collector As New FilteredElementCollector(document)
   Dim elements As ICollection(Of Element) = collector.OfClass(GetType(Family)).ToElements()
   For Each element As Element In elements
      Dim family As Family = TryCast(element, Family)
      Dim category As Category = family.FamilyCategory
      If category IsNot Nothing Then
         Dim familySymbolIds As ISet(Of ElementId) = family.GetFamilySymbolIds()
         If CInt(BuiltInCategory.OST_StructuralColumns) = category.Id.IntegerValue Then
            For Each id As ElementId In familySymbolIds
               Dim symbol As FamilySymbol = TryCast(family.Document.GetElement(id), FamilySymbol)
               columnTypes.Add(symbol)
            Next
         ElseIf CInt(BuiltInCategory.OST_StructuralFraming) = category.Id.IntegerValue Then
            For Each id As ElementId In familySymbolIds
               Dim symbol As FamilySymbol = TryCast(family.Document.GetElement(id), FamilySymbol)
               framingTypes.Add(symbol)
            Next
         End If
      End If
   Next
   Dim message As String = "Column Types: "
   For Each familySybmol As FamilySymbol In columnTypes
      message += vbLf + familySybmol.Name
   Next
   TaskDialog.Show("Revit", message)
End SubExceptions
| Exception | Condition | 
|---|---|
| Autodesk.Revit.Exceptions ArgumentException | Thrown when the input category cannot be assigned to this family. | 
| Autodesk.Revit.Exceptions ArgumentNullException | Thrown when the input category is a null reference ( Nothing in Visual Basic) . |