FilterRule.CreateRule Not Working

Hello.

For some reason I keep getting the warning: "FilterRule.CreateRule operation failed. Method not found: ‘Int64 Revit.Elements.Category.get_Id()’.

I’m attempting to create a dynamo script that creates a filter and overrides the line color to my desired input. The line colors of all duct systems will be modified.

Attached you’ll find my Dynamo script as well as the python script I borrowed from [Categories vs. Category.ByName Discrepancy in 2.13 - #2 by solamour](https://Categories vs. Category.ByName Discrepancy in 2.13)

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import BuiltInCategory,ElementMulticategoryFilter,FilteredElementCollector

import System
from System import Array
from System.Collections.Generic import List

try:
    errorReport = None
    
    cat_list = [BuiltInCategory.OST_DuctAccessory, BuiltInCategory.OST_DuctFitting, BuiltInCategory.OST_DuctInsulations, BuiltInCategory.OST_DuctLinings, BuiltInCategory.OST_DuctCurves]
    typed_list = List[BuiltInCategory](cat_list)
    filter = ElementMulticategoryFilter(typed_list)
    output = FilteredElementCollector(doc).WherePasses(filter).ToElements()

except:
    # if error occurs anywhere in the process catch it
    import traceback
    errorReport = traceback.format_exc()

# Assign your output to the OUT variable
if None == errorReport:
    OUT = output
else:
    OUT = errorReport

Might be the version of Archi-Lab.
Make you sure have the most up to date one for your version of Revit.

2 Likes

Hello @Avery_Sanders if its archilab you use, then try filter rule equals instead of Equals ottb…

1 Like

Ahh. Yes. Thank you for that! I had the version installed for Revit 2024. I’ll try using the latest package for Revit 2023 and see what happens.