Querying Views

In Revit API, Views of all types are represented by the DB.View

You can use the combination of Element.ClassFilter, and Query Types components to collect views:

Notice that the Element.ClassFilter requires the full name of the API class as string input e.g. Autodesk.Revit.DB.View

Querying Views by System Family

In Revit API, View System Families are represented by the DB.ViewFamily enumeration. However, there is a ViewType property on the DB.View instances that also provides the System Family of the view instance. The enumeration for this property is DB.ViewType. DB.ViewFamily and DB.ViewType seems to have been created with the same goal in mind. The components shared here use the DB.ViewFamily to list the views by system family, however, the same results might be achieved using DB.ViewType

To collect views of a certain system family in a model, use a combination of View System Families and Views By System Family components shared here.

View System Families
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Views By System Family
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Querying View Types

In Revit API, View Types are represented by the DB.ViewFamilyType

To collect a list of view types in a model associated with a view system family, use the View Types component shared here.

View Types
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Find Specific View Type

To find a specific view type in a model, use the Find View Type component shared here.

Find View Type
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Querying Views by Type

To collect views of a certain type, use a combination of Find View Type and Views By Type components shared here.

Views By Type
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Finding Specific Views

To find a view by name or by id in the active document, use the Find View component shared here.

As shown above, the Find View component, can search for a view by its name (N) or Title on Sheet (TOS).

Find View
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Accessing Active View

In Revit API, the active view can be accessed from the UI.UIDocument object. The UI.UIDocument is responsible for handling the GUI operations of a view e.g. view window, zooming and panning, etc. Note that there is a legacy UI.UIDocument.ActiveView property that might return non-geometric views e.g. Project Browser (yes that is a View into Revit data). Always access the active view through UI.UIDocument.ActiveGraphicalView to avoid errors

Use the Active View component shared here to get the active view of the current of given document:

Active View
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Analyzing Views

Use the component shared here to get general properties of view elements:

Outputs parameters are:

  • VD: View Direction

 

Analyse View
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Reading View Properties

Use the Element.Decompose component to inspect the properties of a view object.

View Range

In Revit API, View Ranges are represented by the DB.PlanViewRange

To read the view range property of a view, use the Get View Range component shared here.

Get View Range
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Collecting Displayed Elements

To collect all the elements owned by a view, use the Element.OwnerViewFilter component, passed to the Query Elements as shown below. Keep in mind that the 3D geometry that is usually shown in model views are not “Owned” by that view. All 2d elements e.g. Detail items, detail lines, … are owned by the view they have created on.

You can use the Element.SelectableInViewFilter component to only list the selectable elements on a view.

Getting V/G Overrides

To get the Visibility/Graphics overrides for an element on a specific view, use the shared Get VG component.

Get Override VG
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

VG (Destruct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Line VG Settings (Destruct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Surface VG Settings (Destruct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Setting V/G Overrides

To set the Visibility/Graphics overrides for an element on a specific view, use the shared Set VG component.

See Styles and Patterns on how to use the Find Line Pattern and Find Fill Pattern custom components. Here is an example of running the example above on a series of walls in a 3D view:

Set Override VG
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

VG (Construct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Line VG Settings (Construct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Surface VG Settings (Construct)
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Modifying View Types

Work in Progress...

Modifying Views

Work in Progress...

Creating New View Types

Work in Progress...

Creating New Views

Planar Views

Floor Plans

Structural Plans

Reflected Ceiling Plans

Area Plans

Section Views

Elevations

Sections

Detail Views

Legends

Details