I can collect all elements of given category Id:
ICollection<ElementId> ids = new FilteredElementCollector(doc).OfCategoryId(categoryId).ToElementIds();
But how to collect all elements of given top category?
For example I want to collect all elements of top category "Windows" which means all elements where category is Windows->Glass, Windows->Frame/Mullion etc.
Solved! Go to Solution.
Solved by matthew_taylor. Go to Solution.
Please accept our sincerer apology for the delay! We had a backlog in the queue.
In your case, we suggest you using the enum class Autodesk.Revit.DB.BuiltInCategory.
You can try following code:
ElementFilter windowCategoryFilter = new ElementCategoryFilter(BuiltInCategory.OST_Windows); ICollection<ElementId> ids = new FilteredElementCollector(doc).WherePasses(windowCategoryFilter).ToElementIds();
Hi Jim,
Thank you for your answer.
And what about elements inside a family?
For example, in example Revit project rac_basic_sample_project.rvt there is a Curtain wall (see screenchot).
It is category: Wall. How to get all elements ids inside this?
Hi @Act-3D,
The old-fashioned way to do this would be to delete the curtain wall, see which elementIds were deleted, and then rollback the transaction afterwards. (As described for another element type here: http://thebuildingcoder.typepad.com/blog/2010/11/access-to-sketch-and-sketch-plane.html
Now, you can probably get all you need by using the properties of Wall.CurtainGrid.
Not exactly a filteredElementCollector, but I'm not sure that approach is workable in this instance.
Cheers,
-Matt
Can't find what you're looking for? Ask the community or share your knowledge.