RVTDocs.com
Namespace: Autodesk.Revit.DB

Family

Class
Description:
An element that represents a custom family (not a system family) in Autodesk Revit.
Remarks:
Custom families within the Revit API represented by three objects - Family, FamilySymbol and FamilyInstance. Each object plays a significant part in the structure of families. The Family element represents the entire family that consists of a collection of types, such as an 'I Beam'. You can think of that object as representing the entire family file. The Family object contains a number of FamilySymbol elements. The FamilySymbol object represents a specific set of family settings within that Family and represents what is known in the Revit user interface as a Type, such as 'W14x32'. The FamilyInstance object represents an actual instance of that type placed the Autodesk Revit project. For example the FamilyInstance would be a single instance of a W14x32 column within the project.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.Element
    Autodesk.Revit.DB.Family
Syntax
public class Family : Element
Examples
public void GetInfoForSymbols(Family family)
{
    StringBuilder message = new StringBuilder("Selected element's family name is : " + family.Name);
    ISet<ElementId> familySymbolIds = family.GetFamilySymbolIds();

    if (familySymbolIds.Count == 0)
    {
        message.AppendLine("Contains no family symbols.");
    }
    else
    {
        message.AppendLine("The family symbols contained in this family are : ");

        // Get family symbols which is contained in this family
        foreach (ElementId id in familySymbolIds)
        {
            FamilySymbol familySymbol = family.Document.GetElement(id) as FamilySymbol;
            // Get family symbol name
            message.AppendLine("\nName: " + familySymbol.Name);
            foreach (ElementId materialId in familySymbol.GetMaterialIds(false))
            {
                Material material = familySymbol.Document.GetElement(materialId) as Material;
                message.AppendLine("\nMaterial : " + material.Name);
            }
        }
    }

    TaskDialog.Show("Revit",message.ToString());
}