Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List all the families n types in a project.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
bhagya.108
3595 Views, 2 Replies

List all the families n types in a project.

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

2 REPLIES 2
Message 2 of 3
R.van.den.Bor
in reply to: bhagya.108

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.

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 3 of 3

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;
}

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community