Monday, April 25, 2011

Retrieving elements that are not only in the project, but in the model.

For instance, the following Filtered Element Collector will gather all of the types of fascia in the project:

FilteredElementCollector collectorCoreFascia = new FilteredElementCollector(m_doc).OfCategory(BuiltInCategory.OST_Fascia).WherePasses(filter);
IList<Element> coreFascia = collectorCoreFascia.ToElements();

This will get every single type of fascia, whether it's in the model or not.  To get only the pieces that are in the model, we'll check it for a

PhaseCreated != null
inside of our loop:


foreach (Element eCoreFascia in coreFascia)
{
if (null != eCore.Category && 0 < eCore.Parameters.Size && (eCore.Category.HasMaterialQuantities || null != eCore.PhaseCreated) )
  {
 (do something)
  }
}

No comments:

Post a Comment