ElementDesignOptionFilter Class


A filter used to find elements contained within a particular design option.

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

Syntax

C#
public class ElementDesignOptionFilter : ElementQuickFilter
Visual Basic
Public Class ElementDesignOptionFilter _
	Inherits ElementQuickFilter
Visual C++
public ref class ElementDesignOptionFilter : public ElementQuickFilter

Remarks

This filter is a quick filter. Quick filters operate only on the ElementRecord, a low-memory class which has a limited interface to read element properties. Elements which are rejected by a quick filter will not be expanded in memory.

Examples

Copy C#
// Create an ElementDesignOption filter to find all walls in the active design option.
// Note that if no design option is being edited, GetActiveDesignOptionId() method will return ElementId.InvalidElementId,
// ElementDesignOptionFilter with invalid id will filter elements not associated to a design option
ElementId activeOptId = Autodesk.Revit.DB.DesignOption.GetActiveDesignOptionId(document);

// Create an ElementDesignOption filter
ElementDesignOptionFilter filter = new ElementDesignOptionFilter(activeOptId);

// Apply the filter to the elements in the active document,
// use shortcut method OfClass() to find Walls only
FilteredElementCollector collector = new FilteredElementCollector(document);
ICollection<Element> wallsOfDesignOpt = collector.WherePasses(filter).OfClass(typeof(Wall)).ToElements();

// Find all walls that are not contained within active design option: use inverted filter to match elements 
ElementDesignOptionFilter notActiveOptFilter = new ElementDesignOptionFilter(activeOptId, true); // inverted filter
collector = new FilteredElementCollector(document);
ICollection<Element> notActiveOptWalls =
    collector.WherePasses(notActiveOptFilter).OfClass(typeof(Wall)).ToElements();
Copy VB.NET
' Create an ElementDesignOption filter to find all walls in the active design option.
' Note that if no design option is being edited, GetActiveDesignOptionId() method will return ElementId.InvalidElementId,
' ElementDesignOptionFilter with invalid id will filter elements not associated to a design option
Dim activeOptId As ElementId = Autodesk.Revit.DB.DesignOption.GetActiveDesignOptionId(document)

' Create an ElementDesignOption filter
Dim filter As New ElementDesignOptionFilter(activeOptId)

' Apply the filter to the elements in the active document,
' use shortcut method OfClass() to find Walls only
Dim collector As New FilteredElementCollector(document)
Dim wallsOfDesignOpt As ICollection(Of Element) = collector.WherePasses(filter).OfClass(GetType(Wall)).ToElements()

' Find all walls that are not contained within active design option: use inverted filter to match elements 
Dim notActiveOptFilter As New ElementDesignOptionFilter(activeOptId, True)
' inverted filter
collector = New FilteredElementCollector(document)
Dim notActiveOptWalls As ICollection(Of Element) = collector.WherePasses(notActiveOptFilter).OfClass(GetType(Wall)).ToElements()

Inheritance Hierarchy

See Also