I tried to access the curtain wall panels Host properties like below in C# but its inaccessible, is there a way to do it? I really appreciate your help on this.
// Curtain walls
var cwp = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_CurtainWallPanels)
.WhereElementIsNotElementType()
.ToElements();
foreach (var p in cwp)
{
var cwpCategoryName = p.Host.Category.Name; // Error, Element does not contain a definition for 'Host' and no accessible extension method ...
var hostId = p.Host.Id;
var cwpName = p.Host.Name;
var assemblyCode = p.Host.WallType.LookupParameter("Assembly Code").AsValueString();
}
Thanks
Just on a side note, you can completely eliminate the call to
ToElements
. It has nil advantage in this case, and disadvantages using memory, coding (thinking) space and processing time. Unfortunately, I cannot say why theHost
does not deliver what you want. I would suggest snooping the live BIM in Revit desktop using RevitLookup et al. and searching interactively for the required data.