Getting all elements with HasMaterialQuantities condition

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
To retrive all visible elements, we referred the following post in ADN forum . This post suggests to use HasMaterialQuantities()
http://forums.autodesk.com/t5/revit-api/retrieving-all-elements/td-p/3377715
But Category::HasMaterialQuantities is returning false for Topography, railings, and similar elements. So, they are missing when we try to get all the revit model elements. Below is the snippet of code that we are trying.
FilteredElementCollector^ allInstances = gcnew FilteredElementCollector( revitDocument );
allInstances = allInstances->WhereElementIsNotElementType();
for each( Element^ element in allInstances )
{
if( element != nullptr && element->Category != nullptr
&& !element->Category->Name->Contains(“Legend Components”)
&& element->Category->HasMaterialQuantities )
{
GeometryElement^ geomElem = element->Geometry::get(geomOption);
if( geomElem != nullptr && geomElem->GetEnumerator()->MoveNext() ) // Check if this geom element genuinely contains geometry
// put element in list
}
}
Any idea on why HasMaterialQuantities () is skipping visible elements like topography, railings etc.
If we remove the HasMaterialQuantities condition, then we are getting the topography, railings along with all other elements, but we also get extra elements such as Rooms, which are not visible in revit project.
So what should be the right approach so that we get all the visible elements without skipping any valid visible elements like topography, railings etc.
Thanks
Sunil