I want to list out all the families and family types used in a specific project. i want specific parameters like dimensions and materials used of these families.
what commands can i use to retrieve data.
can i use 'Autodesk.Revit.UI.Selection.SelElementSet' for all the elements of a project?
Please help me.
i m new to revit API.
Thank u
Solved! Go to Solution.
Solved by R.van.den.Bor. Go to Solution.
What you can do is use the elementcollectionhelper
Document doc = commandData.Application.ActiveUIDocument.Document;
List<Element> elems = ElementCollectionHelper.GetAllProjectElements(doc).ToList(); //get alle elements
List<Element> elems = ElementCollectionHelper.GetAllProjectElements(doc).Where(c => c.GetType() == typeof(Material)).ToList() //only get the materials;
Then loop over the collection and search for parameters.
For completeness sake, this is how the GetAllProjectElements looks like in the namespace "elementcollectionhelper".
public static List<Element> GetAllProjectElements(Document doc)
{
List<Element> elementList;
FilteredElementCollector elemTypeCtor = (new FilteredElementCollector(doc)).WhereElementIsElementType();
FilteredElementCollector notElemTypeCtor = (new FilteredElementCollector(doc)).WhereElementIsNotElementType();
FilteredElementCollector allElementCtor = elemTypeCtor.UnionWith(notElemTypeCtor);
try
{
elementList = !allElementCtor.Any() ? new List<Element>() : allElementCtor.ToList();
}
catch
{
elementList = new List<Element>();
}
return elementList;
}