Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66860

Select all physical items in model

$
0
0

Hi All, 

 

I am trying to select all the Model Element instances in my model. i.e. anything that is a physical object, so I can change the value of a certain Property on all of them. Property value will be different depending on where the instance is in the model. I have the below method but it is not picking up host families or the likes of ducts. Help appreciated.

 

IList<Element> GetAllElements(Document doc)
{


ElementClassFilter FamilyInstanceFilter = new ElementClassFilter(typeof(FamilyInstance));
FilteredElementCollector FamilyInstanceCollector = new FilteredElementCollector(doc);
IList<Element> ElementsCollection = FamilyInstanceCollector.WherePasses(FamilyInstanceFilter).ToElements();
IList<Element> AllModelElements = new List<Element>();


foreach (Element e in ElementsCollection)
{

if ((null != e.Category)
&& (null != e.LevelId)
&& (null != e.get_Geometry(new Options()))
)
{
AllModelElements.Add(e);
}
}
return AllModelElements;
}


Viewing all articles
Browse latest Browse all 66860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>