Create Method (Document, String, ICollection(ElementId), ElementFilter)


Creates a new ParameterFilterElement in the given document.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since: 2019

Syntax

C#
public static ParameterFilterElement Create(
	Document aDocument,
	string name,
	ICollection<ElementId> categories,
	ElementFilter elementFilter
)
Visual Basic
Public Shared Function Create ( _
	aDocument As Document, _
	name As String, _
	categories As ICollection(Of ElementId), _
	elementFilter As ElementFilter _
) As ParameterFilterElement
Visual C++
public:
static ParameterFilterElement^ Create(
	Document^ aDocument, 
	String^ name, 
	ICollection<ElementId^>^ categories, 
	ElementFilter^ elementFilter
)

Parameters

aDocument
Type: Autodesk.Revit.DB Document
The document in which to create the ParameterFilterElement.
name
Type: System String
The user-visible name for the new ParameterFilterElement.
categories
Type: System.Collections.Generic ICollection ElementId
The categories for the new ParameterFilterElement.
elementFilter
Type: Autodesk.Revit.DB ElementFilter
The rules for the new ParameterFilterElement, represented as an ElementFilter. ElementFilter is either an ElementParameterFilter or an ElementLogicalFilter representing a Boolean combination of ElementParameterFilters. In addition, we check that each ElementParameterFilter satisfies the following conditions: Its array of FilterRules is not empty and contains:
  • Any number of FilterRules of type FilterValueRule, FilterInverseRule, and SharedParameterApplicableRule or
  • Exactly one FilterCategoryRule containing only one category from categories stored by this ParameterFilterElement or
  • Exactly two rules: the first one is a FilterCategoryRule containing only one category from categories stored by this ParameterFilterElement and the second one is a FilterRule of type FilterValueRule, FilterInverseRule, or SharedParameterApplicableRule.
Note that cases in the second and third bullet are currently allowed only if the parent node of ElementParameterFilter is LogicalOrFilter.

Return Value

A pointer to the new ParameterFilterElement.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException name is an empty string or contains only whitespace. -or- name cannot include prohibited characters, such as "{, }, [, ], |, ;, less-than sign, greater-than sign, ?, `, ~". -or- The given value for name is already in use as a filter element name. -or- One of the given rules refers to a parameter that does not apply to this filter's categories.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions ArgumentsInconsistentException The ElementFilter is not acceptable for use by a ParameterFilterElement.

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 →