Share

ViewFamilyType.ViewFamily Property

The ViewFamily for this view type.


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

Syntax

C#

public ViewFamily ViewFamily { get; }

Property Value

ViewFamily

Example

C#

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

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

    return viewFamily;
}

VB

Public Function GetViewFamily(doc As Document, view As View) As ViewFamily
    Dim viewFamily__1 As ViewFamily = ViewFamily.Invalid

    Dim viewTypeId As ElementId = view.GetTypeId()
    Dim viewTypeIdOne As ElementId = New ElementId(1L)
    If viewTypeId > viewTypeIdOne 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

Reference

Was this information helpful?