Issue with Creating View Filter

Hi All,

I’m trying to create a basic view filter, as per the below:

I’ve tried this using 3 various approaches: OOTB, Archi-lab & Bakery as shown below:

None of the methods are producing a View Filter…

The OOTB approach gives me the following error message:
Warning: ParameterFilterElement.ByRules operation failed.
One of the given rules refers to a parameter that does not apply to this filter’s categories.
Parameter name: elementFilter

The Archilab approach gives me:
Warning: ViewFilter.CreateFilter operation failed.
Method not found: ‘Void Autodesk.Revit.DB.ParameterFilterElement.SetRules(System.Collections.Generic.IList`1<Autodesk.Revit.DB.FilterRule>)’.

And the Bakery method gives me a null.

I have a feeling it’s the Parameter Name input which is giving me trouble…

I’ve tried to snoop the properties of the floor to determine what the parameter name I’m trying to filter is, and from what I can gather, it is “Name” (see below),


however when I search for BuiltInParameter.ByName the closest thing I can find is ELEM_TYPE_PARAM…

Can anybody point out where i’m going wrong in my approach? I feel like i’ve tried this every which way over the last 24 hours to no avail…

Thanks.

Script: View Filters_.dyn (61.3 KB)

EDIT: Also tried the approach below:


But i am getting the following error message:
Warning: ParameterFilterElement.ByRules operation failed.
One of the given rules refers to a parameter that does not apply to this filter’s categories.
Parameter name: elementFilter

Assuming you are using Revit 2020, you may not be able to use some of those custom nodes due to updates to the Revit API for that version. The SetRules() method has this note in the documentation:

“This method is deprecated in Revit 2019 and will be removed in the next version of Revit. We suggest you instead use SetElementFilter instead.”

As for the OOTB node, the error is completely different. Is there a reason you are using “Type” as your parameter instead of “Type Name”. It’s also possible that the Parameter.ParameterByName node is getting the wrong parameter named “Type”.

1 Like

Thanks for taking the time to respond.

Yeah I am using 2020 - I thought that might have changed things up a little as the view filters were revised with this release.

When you say the “SetRules() method” - what are you referring to? Is that another node package?

Is there a package that you know of to create view filters and apply them to views using Revit 2020 - that is with the ability to specify AND or OR rules? Or is it possible with the OOTB nodes - do they work with the 2020 API?

Type was yielding the correct result so I thought that’s what I wanted, and also when I select a floor and edit type, it’s “type” is what i was after, although in the filters dialogue box it states Type Name…couldn’t figure out what that parameter is actually called…very confusing…

Edit: I changed it to Type Name (using the OOTB method) and now it’s gone grey and seems to be working…Thanks!

SetRules is referring to the method used in the underlying code in the Archilab node. When the node is opened in Revit, it uses the version of the API for that specific version of Revit. So, it will work in 2015, 2016…2019, however that specific part of the API no longer exists in Revit 2020. So, it will always raise this error in Revit 2020 and later versions:

Method not found: 'Void Autodesk.Revit.DB.ParameterFilterElement.SetRules(System.Collections.Generic.IList1<Autodesk.Revit.DB.FilterRule>)'.

1 Like

So what I’m gathering is that currently no package exists to handle filters with the Revit 2020 API, and so I either learn some python or wait around…

Due to a bunch of the Archilab view filter nodes giving me a ‘Method not found’ error, I take it they’ve become deprecated and don’t fully function with the Revit 2020 API?

I have created the filter using the OOTB method but modifying graphics overrides is proving problematic without the Archilab nodes…

Thanks for all your advice and information. Much appreciated.