By modeled elements I mean I want to get all elements for construction such as walls, beams, foundations, windows, doors, ducts, etc. This is to later use all these elements to create a map of quantities of the elements for construction.
I have tried:
FilteredElementCollector collector = new FilteredElementCollector(doc); collector.WhereElementIsNotElementType().OfClass(typeof(FamilyInstance));
But strangely I am not obtaining any elements.
Any help would be appretiated
Solved! Go to Solution.
Solved by FAIR59. Go to Solution.
FamilyInstance objects are only for the custom families (i.e. Furniture, Beams, etc) and not the system families (i.e. Wall, Floor, etc.)
For what you are trying to retrieve, I would use the following:
FilteredElementCollector collector = new FilteredElementCollector(doc); collector.WhereElementIsNotElementType().WhereElementIsViewIndependent();
This will exclude all element types (Wall Types as opposed to actual Walls) and view-specific elements (annotations, etc.)
Thank you for your help @BardiaJahan!
But this filter still retrieves too many elements (4936).
Is there a way I can only retrieve the constructed elements?
Can't find what you're looking for? Ask the community or share your knowledge.