ViewFamily Property


The ViewFamily for this view type.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2013

Syntax

C#
public ViewFamily ViewFamily { get; }
Visual Basic
Public ReadOnly Property ViewFamily As ViewFamily
	Get
Visual C++
public:
property ViewFamily ViewFamily {
	ViewFamily get ();
}

Examples

Copy C#
public ViewFamily GetViewFamily(Document doc, View view)
{
    ViewFamily viewFamily = ViewFamily.Invalid;

    ElementId viewTypeId = view.GetTypeId();
    if (viewTypeId.IntegerValue > 1) // some views may not have a ViewFamilyType
    {
        ViewFamilyType viewFamilyType = doc.GetElement(viewTypeId) as ViewFamilyType;
        viewFamily = viewFamilyType.ViewFamily;
    }

    return viewFamily;
}
Copy VB.NET
Public Function GetViewFamily(doc As Document, view As View) As ViewFamily
    Dim viewFamily__1 As ViewFamily = ViewFamily.Invalid

    Dim viewTypeId As ElementId = view.GetTypeId()
    If viewTypeId.IntegerValue > 1 Then
        ' some views may not have a ViewFamilyType
        Dim viewFamilyType As ViewFamilyType = TryCast(doc.GetElement(viewTypeId), ViewFamilyType)
        viewFamily__1 = viewFamilyType.ViewFamily
    End If

    Return viewFamily__1
End Function

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →