lisa-marie mueller

lisa-marie mueller

bullet pont

filtered element collector [c#] link

October 4, 2019

Laptop with code on screen, toy bird, toy rocket Whenever I start a new set of Construction Documents in Revit, there are certain tasks that I -and I’m sure many of my colleges and even many of you- despise. This is how my ‘Automation Wish List’ has developed. Every time I do something I dislike doing, I put it on the list. I have chosen one of these topics to cover first, interior elevations. Since I work primarily in the Civic sector we work on the interior design for our projects, all of our rooms have interior elevations, and the interior elevations often get quite detailed. I have been building a plug-in that automates various parts of creating interior elevations, and I will continue to develop it. Since this project will evolve as I continue, I have determined to set my primary goal for each stage. With this goal in mind, I will develop a functioning piece of software to meet the goal. Then I will discuss topics that cover key aspects for each step for building the plug-in. At the end of each stage, I will move the plug-in to a public repository on GitHub so you can use it too.

primary goal #1

Create interior elevations for all placed rooms, place the tag at the center of the rooms, place the tag on the correct level when multiple levels exist, ensure the tag is visible on the interior elevation key plans (already in the project), and ensure the interior elevation tags have the proper phase settings

getting started

To start, we need to collect all the rooms in the project. This is how we will find the center of the room and place the tags. To find the rooms, we will use what I have determined is, for myself, the most important and most used building block of the Revit API. I would describe the Filtered Element Collector class as a queryable collection of Revit objects. If you are new to programming, it takes all the elements in your Revit model and puts them in a bag. Then it allows you to filter out elements you do not want based on parameters you provide. After you filter, you have the elements you wanted left in the bag. In programming, you actually have to keep those elements somewhere and this will generally be a list or a single object, depending on what you need. For our case, we can very quickly collect all the rooms and store them in a list.

Next week, we will find the center of the rooms and take a look at some exceptions we need to consider so our program doesn't crash.

resources

If you want to learn to code and don’t know where to start check out my posts about Steps to Learn to Code [for architects and designers] Part 1 and Part 2.

Revit API Docs