C# revit API - CREATE PARAMETER FILTER - SETRULES METHOD DEPRECATED

C# revit API - CREATE PARAMETER FILTER - SETRULES METHOD DEPRECATED

Anonymous
Not applicable
2,366 Views
4 Replies
Message 1 of 5

C# revit API - CREATE PARAMETER FILTER - SETRULES METHOD DEPRECATED

Anonymous
Not applicable

Hello Everyone,

 

I try to solve a problem since a moment, but I did not find the solution yet.

I use REVIT 2019.

In this version I use "SetRules" Method in a macro which has to create Parameter filters.

This Method works today in REVIT 2019.

But When compiling the code, I have a warning message. It warns me against the Method "SetRules" which is deprecated and will not be available anymore in the next version of REVIT.

It suggests me to use the method "SetElementFilter" instead of "SetRules".

But I Don't find any example of this new Method.

Moreover these two methods Don't have the same entry argument.

Setrules has a list of Filterrule as entry argument

SetElementFilter would have ElementFilter as entry argument

 

Could someone help me concerning this problem? Can we have a example that works?

On Autodesk

Thank you Very much

LD

0 Likes
Accepted solutions (1)
2,367 Views
4 Replies
Replies (4)
Message 2 of 5

JimJia
Alumni
Alumni

Hi

 

You may noticed that the ElementParameterFilter is derived class of ElementFilter.

 

So, you can create ElementParameterFilter with origin FilterRules and then use these ElementParameterFilter for SetElementFilter. 

 

Find more details about the ElementParameterFilter API here:

http://www.revitapidocs.com/2018.1/b0b40351-690c-eb5d-30c2-d4447a42fda1.htm

 

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi

 

Could you give me an example please?

 

??

0 Likes
Message 4 of 5

lwlXUTTT
Advocate
Advocate
Accepted solution

instead of using

ParameterFilterElement.SetRules(fRules)

you need to use

ParameterFilterElement.SetElementFilter(new ElementParameterFilter(fRules))

 

hope that helps,

Best, Luki

0 Likes
Message 5 of 5

Anonymous
Not applicable

Thank you very much

That is exactly what I am looking for.

 

 

Thank's

0 Likes