Revit-API-09

/

/

/

revit-api/09-master-getting-elements

Master Getting Elements with Revit API

Getting the right elements is often half the solutions. So let's learn how to do it with FilteredElementCollector Class.

Revit-API-09

/

/

/

revit-api/09-master-getting-elements

Master Getting Elements with Revit API

Getting the right elements is often half the solutions. So let's learn how to do it with FilteredElementCollector Class.

Summary

Final Basic Concept

You've already learnt so much about Revit API!

You probably can not wait to finally start creating new awesome tools for Revit, but let's cover on more very important concept to get elements from your projects.

We will be working with FilteredElementCollector, this is a class that have many built-in filters to decide what kind of elements you want to get outside of your project.

It also might look complicated and scary to use, but it's actually one of the easiest one to use, because it's very repetitive. Have a look at the example:

Wait, don't close the lesson. I know it looks long and hard to read. But we can break it down into 4 steps:

  • Create Collector - Create a collector for your proejct

  • Filter with OfCategory - Filter elements by Category

  • Filter with WhereElementIsElementType - Filter Instances or Types

  • ToElements - Convert collector to a list of elements

Don't worry, we will break it all down.

Filtered Element Collector Anatomy

Let's look into Filtered Element Collector anatomy.

📘I've prepare a few good pages to explain it in my free E-Book: Beginner's Guide to Revit API.

📙I also have another E-Book specifically about FilteredElementCollector and its Filters, where you can find a lot more examples. You can get it here.

Code Examples

all_walls_cat   = FilteredElementCollector(doc) \
                    .OfCategory(BuiltInCategory.OST_Walls) \
                    .WhereElementIsNotElementType() \
                    .ToElements()

all_floors      = FilteredElementCollector(doc) \
                    .OfCategory(BuiltInCategory.OST_Floors) \
                    .WhereElementIsNotElementType() \
                    .ToElements()

⚠️WORK IN PROGRESS:
Check in a few hours…⚠️

HomeWork

⌨️ Happy Coding!

Questions:

Q

Q

Discuss the lesson :

P.S. Sometimes this chat might experience connection issues.

Use Discord App for best experience.

Discuss the lesson :

P.S. Sometimes this chat might experience connection issues.

Use Discord App for best experience.

Unlock Community

The pyRevit Hackers Community is only available with pyRevit Hackers Bundle.
Upgrade Here to Get Access to the community and all pyRevit Courses.

Use coupon code "upgrade" to get 150EUR Discount as a member.

⌨️ Happy Coding!

Unlock Community

The pyRevit Hackers Community is only available with pyRevit Hackers Bundle.
Upgrade Here to Get Access to the community and all pyRevit Courses.

Use coupon code "upgrade" to get 150EUR Discount as a member.

⌨️ Happy Coding!

Discuss the lesson :

P.S. Sometimes this chat might experience connection issues.

Use Discord App for best experience.

Discuss the lesson :

P.S. Sometimes this chat might experience connection issues.

Use Discord App for best experience.

Discuss the lesson :

P.S. Sometimes this chat might experience connection issues.

Use Discord App for best experience.

Unlock Community

The pyRevit Hackers Community is only available with pyRevit Hackers Bundle.
Upgrade Here to Get Access to the community and all pyRevit Courses.

Use coupon code "upgrade" to get 150EUR Discount as a member.

⌨️ Happy Coding!

Unlock Community

The pyRevit Hackers Community is only available with pyRevit Hackers Bundle.
Upgrade Here to Get Access to the community and all pyRevit Courses.

Use coupon code "upgrade" to get 150EUR Discount as a member.

⌨️ Happy Coding!

Unlock Community

The pyRevit Hackers Community is only available with pyRevit Hackers Bundle.
Upgrade Here to Get Access to the community and all pyRevit Courses.

Use coupon code "upgrade" to get 150EUR Discount as a member.

⌨️ Happy Coding!

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API