I want to iterate through all the equipment in a drawing and get the name of the equipment.
Here is what I have:
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
// get all PanelScheduleView instances in the Revit document.
FilteredElementCollector fec = new FilteredElementCollector(doc);
ElementClassFilter EquipmentViewsAreWanted = new ElementClassFilter(typeof(ElectricalEquipment));
fec.WherePasses(EquipmentViewsAreWanted);
List<Element> eViews = fec.ToElements() as List<Element>;
StringBuilder Disp = new StringBuilder();
foreach (ElectricalEquipment element in eViews)
{
Disp.Append("\n" + element.);
}
System.Windows.Forms.MessageBox.Show(Disp.ToString());
I get the following error at the foreach loop:
Error 1 Cannot convert type 'Autodesk.Revit.DB.Element' to 'Autodesk.Revit.DB.Electrical.ElectricalEquipment'
Any suggestions?