Hello, I’m working on converting a custom python node (written by conrad) to a c# node. In this process, I realized I don’t know how to output a Revit.DB.Element as a Revit.Elements.Element type.
Here is the code:
public static List<Revit.Elements.Element> GetElementsOfFamilyType(List<Revit.Elements.Element> types)
{
Document doc = DocumentManager.Instance.CurrentUIDocument.Document;
List<Element> elems = new List<Element>();
List<Element> activeElems = new List<Element>();
List<Revit.Elements.Element> output = new List<Revit.Elements.Element>();
foreach (Revit.Elements.Element e in types)
{
elems.Add(e.InternalElement);
}
foreach(Revit.Elements.Element x in types)
{
FilteredElementCollector catCollector = new FilteredElementCollector(doc);
BuiltInCategory cat = (BuiltInCategory)Enum.Parse(typeof(BuiltInCategory), x.GetCategory.Id.ToString());
catCollector.OfCategory(cat);
foreach(Element item in catCollector.ToElements())
{
if(item.GetTypeId().IntegerValue == x.Id)
{
activeElems.Add(item);
output.Add(x);
}
}
}
return output;
}
Currently, when I return output I get the types, which is not what I want. Previously I was returning ‘activeElems’ as a list of Revit.DB.Element, however that cannot work with other dynamo nodes. How do I convert the activeElems list to a list of type ‘Revit.Elements.Element’?