Difference between two FilteredElementCollector-s

Difference between two FilteredElementCollector-s

Anonymous
Not applicable
1,295 Views
3 Replies
Message 1 of 4

Difference between two FilteredElementCollector-s

Anonymous
Not applicable

Hi. I am new to Revit API. In many examles of code with filtering of elements that i saw there was a code like:

FilteredElementCollector f1 = new FilteredElementCollector(CurrentRevitDocument).OfClass(typeof(FamilyInstance)).OfCategory(CATEGORY_HERE);
FilteredElementCollector f2 = new FilteredElementCollector(CurrentRevitDocument).OfCategory(CATEGORY_HERE);

I know about categories, types and so on but I can not understand, for examle

1. What is the difference in f1 and f2, f1 don't have family symbols in it or what?

2. How does work differ with these collectors?

3. Can you please give me the examle of correct code for filterring all elements in the revit part using, for examle, foreach cycle with BuiltInCategory, for better understanding?

Thanks for any help.

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

jeremytammik
Autodesk
Autodesk
Accepted solution

The filtered element collector class itself does provide some Boolean methods.

 

You can also limit the set of input elements by passing in a list of element ids.

 

For numerous in-depth discussions of filtered element collector usage, please refer to the corresponding topic group shared by The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9

 

For many more examples, look at The Building Coder samples, and especially its module CmdCollectorPerformance.cs:

 

https://github.com/jeremytammik/the_building_coder_samples

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/C...

 

That should provide all you need and more.

 

Cheers,

 

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

jeremytammik
Autodesk
Autodesk

Oh, your question maybe has less to with the API than a basic understanding of underlying Revit principles.

  

Before looking further into your question from the API point of view, please learn and understand the difference and relationships between Revit:

 

  • Family definitions, standard and system
  • Family symbols or types, which may actually be WallType or similar in the case of system families
  • Family instances, which may actually be Wall or other specific elements in the case of system families

 

I hope this clarifies.

 

Thank about it and you will be able to answer your question yourself, and many others besides.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 4

Anonymous
Not applicable

Thank you for your reply.

0 Likes