Getting View Filter Rule Data in Revit 2019

Getting View Filter Rule Data in Revit 2019

Rockit_for_Revit
Advocate Advocate
1,772 Views
2 Replies
Message 1 of 3

Getting View Filter Rule Data in Revit 2019

Rockit_for_Revit
Advocate
Advocate

Revit 2019 is saying ParameterFilterElement.GetRules is depreciated and to use GetElementFilter instead.

However I cannot see how to get the Rule data from an ElementFilter.

Any ideas?

Kind Regards

David

0 Likes
Accepted solutions (1)
1,773 Views
2 Replies
Replies (2)
Message 2 of 3

JimJia
Alumni
Alumni

Dear David Rock,

 

The FilterRule is applicable to element parameter related, so the FilterRule can be retrieved from ElementParameterFilter.

 

Note that ElementParameterFilter is derived class of ElementFilter, so you can cast the ParameterFilterElement.GetElementFilter() to ElementParameterFilter first, and then retrieve the filter rules via ElementParameterFilter.GetRules().

 

The better API documentation should like this: "This method is deprecated in Revit 2019 and will be removed in the next version of Revit. We suggest you instead use GetElementFilter instead: cast the filter to ElementParameterFilter and then retrieve the filter rules from ElementParameterFilter.GetRules()."

   

 

 


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 3

david_rock
Enthusiast
Enthusiast
Accepted solution

Thanks,

Actually I have found the answer here:

https://forums.autodesk.com/t5/revit-api-forum/how-get-filter-rule-info/m-p/8116747#M32147

Kind Regards

David

 

0 Likes