I want to Add a new filter to Revit using pyrevit but it gives me an error: TypeError: expected ICollection[ElementId], got list
I don’t know where I went wrong. Here is my code:
from Autodesk.Revit.DB import BuiltInCategory, ElementId, ParameterFilterElement, Transaction
from Autodesk.Revit.DB import FilterRule, ParameterFilterRuleFactory
# create list of categories that will be selected for the filter
categories = [ElementId(BuiltInCategory.OST_GenericModel)]
# create a list of rules for the filter
rules = []
family_name_parameter_id = ElementId(BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM)
rules.append(ParameterFilterRuleFactory.CreateEqualsRule(family_name_parameter_id, "BIM-Конфликт", False))
filter = None
# assuming 'doc' and 'view' are already defined
# 'doc' is the current Revit document and 'view' is the view where you want to apply the filter
t = Transaction(doc, "Create and Apply Filter")
t.Start()
filter = ParameterFilterElement.Create(doc, "BIM", categories, rules)
view.AddFilter(filter.Id)
view.SetFilterVisibility(filter.Id, True)
t.Commit()