From the course: Dynamo: Revit Workflow

Roadmap: Renumber rooms by level - Revit Tutorial

From the course: Dynamo: Revit Workflow

Start my 1-month free trial

Roadmap: Renumber rooms by level

- [Instructor] For our first example, we're going to cover an exercise in room numbering. A standard way of numbering rooms in an architectural project is to begin each room number with a digit that represents which building story or which level the room is found on. So all the rooms on level one would begin with the number one, level two rooms would begin with a two, and so on all the way up the building. If you look at the Revit file that comes with this course's exercise files, we're working with a three story building. However, the current state of our Revit project doesn't obey this standard room numbering convention. Rooms are numbered sequentially, starting with room zero one on the ground floor, then zero two, zero three, and so on, with no regard to which level the room is found on. Imagine that you're the person and charged with the task of renumbering these rooms so they adhere to this numbering standard. This is a fairly small project, so sure you could go room by room, and type a prefix in front of each room number and you'd probably be finished renumbering this project within 20 minutes. But what if this wasn't such a small, three story project, but an urban residential tower, or a sprawling complex with hundreds and hundreds of rooms? It would be much faster to write a script in Dynamo that churns through these rooms in seconds, rather than spend the better part of your day doing something as tedious as this. So, the Dynamo challenge before us is this. Let's renumber all of the rooms in this Revit project so that they begin with a prefix that indicates which level the room is on. One of the most daunting aspects of learning Dynamo is approaching a problem like this one and having no idea how to begin. We're fairly certain that if we pick the exact right combination of Dynamo notes from the library and string them together in the right order, it will automatically perform this task for us. But how do we go about solving this puzzle? Henry Ford is quoted to have said, nothing is particularly hard if you divide it into small jobs. The key to solving your problems computationally is figuring out how to take the problem and break it down into a series of miniproblems that are easier to accomplish with just a few Dynamo notes each. During this course, we'll refer to this step as building a road map. Let's begin our road map now. First, let's identify what we need as our inputs. Our inputs to a Dynamo graph are usually either of two things. What are the Revit elements that we're about to work with or what are the sources that we need to gather information from? Since we're working with the room objects in this project, we can start by gathering all of the room objects in the Revit file. It's also a good idea to identify how this workflow is going to end. What's the last step of this process that reaches the goal that we've set for ourselves? In this case, we need to end by writing new room numbers back to the Revit room objects so that the floor plans and schedules on the project report rooms with prefixes based on the building story. Now for the big question, what in the world happens in the middle? The key to identifying those middle steps in the road map is to think about what sequence of questions you need to ask the data that you've collected so far in order to eventually arrive at your output. If we were to do this problem the long way, one room at a time, without Dynamo's help, we'd click on a room element, look at the name of the level it's hosted on, and then look at the room number. You'd start by gathering two pieces of information directly from the room element, the level name and the room number. So let's have Dynamo start there, by asking each room the name of the level it belongs to and the current number of the room. Now at the end of the workflow, when we rewrite the room's number, we don't want to write the entire name of level one or level two or level three. We're only interested in adding the number one, two, or three to the room number, so we'll need to turn our level name into a single number, probably by asking what the last character name of the level name is. Once we have that, we have all the information that we need to rewrite the room numbers. We can join the single digit level number to the room number and then we're abiding by the numbering standard. We're ready to push that data back out to the Revit project and our task is done. Now that we have a solid roadmap that lays out the steps we need to accomplish, let's jump into Revit and begin writing our Dynamo graph.

Contents