Reputation: 8731
For an export add-in on revit 2014, I need to get all building elements in the opened project.
To get elements, I am currently using a logicalfilter :
new LogicalOrFilter(new ElementIsElementTypeFilter(true),new ElementIsElementTypeFilter(false));
then I parse them using some filters on category ID, using Element.Category.Id.IntegerValue to compare it with every elements in my arrays.
I can get all elements, but some parameters are missing:
also, when I get elements, some elements doesn't have name, or a meaningless name like "300x75", not the element name (Wood Door for example).
Upvotes: 0
Views: 1257
Reputation: 1096
Supamiu, Some of this depends on what you're really trying to do. The LogicalOrFilter you're using will generally pull in every element - whether it is a "Type" element or an "Instance" element (and others that are really neither, like Families, Materials, etc).
To investigate how many doors you have, you'll need to count the Instance elements of a particular category. In my experience, often for "family"-type elements, you might not get a valid element category, and you must navigate from FamilyInstance->FamilySymbol->Family and then check the "FamilyCategory" property. Also, you are likely to run into some elements in your filter which have NULL for a category (usually weird, internal elements).
The Unit Type is stored in each parameter's definition (i.e. Length, Area, Text, etc), as is the DisplayUnitType, an enum that has all of the available display options.
I believe that the Element.GetMaterialIds() is a good reflection of all of the materials that are present in INSTANCE elements, at least.
Good Luck, Matt
Upvotes: 0