Family.FamilyCategory
Public Property
ArgumentException
ArgumentNullException
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: 25.0.0.0 (25.0.0.0)
Syntax
public Category FamilyCategory { get; set; }
Property Value
CategoryExceptions
Exception
Condition
ArgumentException
Thrown when the input category cannot be assigned to this family.
ArgumentNullException
Thrown when the input category is ..
Remarks
All category objects can be retrieved from the application by using the Categories property of the Application.Settings object.
Example
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 (BuiltInCategory.OST_StructuralColumns == category.BuiltInCategory) { foreach (ElementId id in familySymbolIds) { FamilySymbol symbol = family.Document.GetElement(id) as FamilySymbol; columnTypes.Add(symbol); } } else if (BuiltInCategory.OST_StructuralFraming == category.BuiltInCategory) { 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);}