collector.OfClass(typeof(??)).ToElement();

collector.OfClass(typeof(??)).ToElement();

sragan
Collaborator Collaborator
775 Views
2 Replies
Message 1 of 3

collector.OfClass(typeof(??)).ToElement();

sragan
Collaborator
Collaborator

Is there a list anywhere of the type of elements that can be used in this filter?

 

Just using the suggestions the editor gives, many don't work.   And it seems like this would be in the documentation or Revit API help, but I sure can't find it anywhere.

 

In particular, I was trying to get the Note block families.   But "AnnotationSymbol" isn't a valid type.

0 Likes
776 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

The ones you can't use are listed under ElementClassFilter in the RevitAPI.chm and the extraction of it below.

 

ElementClassFilter Class (revitapidocs.com)

 

Not aware of the opposite list but I'd start by avoiding the ones listed.

 

Most of the time you don't need to use it since you have ElementCategoryFilter. So you usually only use it for the convenient cases you know it works for.

0 Likes
Message 3 of 3

caroline.gitonga
Autodesk
Autodesk

Hi @sragan,

This method type provides a quick filter on elements only whose class is an exact match to the input class,
or elements whose type is derived from the input class will pass the collector.

As @RPTHOMAS108  has said above, to be on safe side and to cover wide area of your interest, you could use ElementCategoryFilter class which utilizes the BuiltInCategory method that lists all the built in categories within Revit.
You can check out the list of all members provided in the RevitAPI.chm file of the Revit SDK.

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes