FamilyInstance Class
This object represents a single instance of a family type, such as a single I beam.

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

Syntax

C#
public class FamilyInstance : Instance
Visual Basic
Public Class FamilyInstance _
	Inherits Instance
Visual C++
public ref class FamilyInstance : public Instance

Remarks

Examples of FamilyInstance objects within Autodesk Revit are Beams, Columns, Braces and Desks. The FamilyInstance object provides more detailed properties that enable the type of the family instance to be changed, thus changing their appearance within the project.

Examples

CopyC#
public void GetInfo_FamilyInstance(FamilyInstance familyInstance)
{
    string message = "FamilyInstance : ";
    // Get FamilyInstance host name
    if (familyInstance.Host != null)
    {
        message += "\nFamilyInstance host name is : " + familyInstance.Host.Name;
    }

    foreach (ElementId materialId in familyInstance.GetMaterialIds(false))
    {
        Material material = familyInstance.Document.GetElement(materialId) as Material;
        message += "\nFamilyInstance e material : " + material.Name;
    }
    // Get FamilyInstance room name
    if (familyInstance.Room != null)
    {
        message += "\nFamilyInstance room name is : " + familyInstance.Room.Name;
    }

    // Get FamilyInstance structural type
    message += "\nFamilyInstance structural type is : " + familyInstance.StructuralType;

    // Get FamilyInstance structural usage
    message += "\nFamilyInstance structural usage is : " + familyInstance.StructuralUsage;

    TaskDialog.Show("Revit",message);
}
CopyVB.NET
Public Sub GetInfo_FamilyInstance(familyInstance As FamilyInstance)
 Dim message As String = "FamilyInstance : "

 ' Get FamilyInstance host name
 If familyInstance.Host IsNot Nothing Then
        message += vbLf & "FamilyInstance host name is : " & Convert.ToString(familyInstance.Host.Name)
    End If

    For Each materialId As ElementId In familyInstance.GetMaterialIds(False)
        Dim material As Material = TryCast(familyInstance.Document.GetElement(materialId), Material)
        message += vbLf & "FamilyInstance e material : " + material.Name
    Next
    ' Get FamilyInstance room name
    If familyInstance.Room IsNot Nothing Then
        message += vbLf & "FamilyInstance room name is : " & Convert.ToString(familyInstance.Room.Name)
    End If

    ' Get FamilyInstance structural type
    message += vbLf & "FamilyInstance structural type is : " & Convert.ToString(familyInstance.StructuralType)

    ' Get FamilyInstance structural usage
    message += vbLf & "FamilyInstance structural usage is : " & Convert.ToString(familyInstance.StructuralUsage)

    TaskDialog.Show("Revit", message)
End Sub

Inheritance Hierarchy

System..::..Object
  Autodesk.Revit.DB..::..Element
    Autodesk.Revit.DB..::..Instance
      Autodesk.Revit.DB..::..FamilyInstance
        Autodesk.Revit.DB..::..AnnotationSymbol
        Autodesk.Revit.DB..::..Mullion
        Autodesk.Revit.DB..::..Panel

See Also