Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Model contains semi-duplicated filters that do not appear under View -> Filters

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Yair.bar
226 Views, 4 Replies

Model contains semi-duplicated filters that do not appear under View -> Filters

Using the FilteredElementCollector pasted below I'm querying the model for all ParameterFilterElements. Instead of returning to me the exact list of ParameterFilterElements seen in the View -> Filters command, I get a list that also includes a number of hidden ParameterFilterElements that have the same names as some of the visible ParameterFilterElements found in View -> Filters but not the same IDs or rules sets. It seems like half of my filters were somehow created twice with the duplicate one being hidden in the model and not containing the same rules. 

 

var filters = new FilteredElementCollector(doc)
            .OfClass(typeof(ParameterFilterElement)).ToElements()
            .Cast<ParameterFilterElement>()
            .ToArray();

 

To try to work around this I wanted to find a way to programmatically get the list of ParameterFilterElements directly from the View -> Filters command and compare my FilteredElementCollector's results against it to find and remove the extra ones, but I can't find a way to do so.

 

In general, is there any explanation / remedy for this weirdness?

 

Thanks!

4 REPLIES 4
Message 2 of 5
architect.bim
in reply to: Yair.bar

Hi!

The best way to help you is to look into your particular model. Is there any chance to see it?


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 3 of 5
Yair.bar
in reply to: architect.bim

I sadly can't show the model, but if it helps, I have thoroughly inspected both filter objects and they are identical up until the ID and rules. Is there any way you can think of to pull the "Rule-based Filters" from the View -> Filters command other than using the FilteredElementCollector that I'm using? Or any other method of comparing all the model's filters to the filters that I have set in the View -> Filters command? That seems like the only method of determining which filter objects are correct.
Message 4 of 5
architect.bim
in reply to: Yair.bar

Hi!

Unfortunately I do not know any method to collect filters rather than to use FilteredElementCollector. May be you are able to delete all model elements, views and sheets from the project. And than share it? This would help a lot to understand the problem.


Maxim Stepannikov | Architect, BIM Manager, Instructor
Message 5 of 5
Yair.bar
in reply to: architect.bim

Hello,

Thanks for the reply and sorry for this late response. I was lucky enough to see a pattern with the ID's of the duplicate filters (smaller ID numbers were the originals). So, for now my problem is solved, and hopefully this fix continues to work correctly :). I'm assuming this happened due to some user error somewhere along the way, and not Revit randomly inserting duplicate filters (hopefully).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community