SIGN UP

9 Steps to Renumber Doors by Room Using Dynamo

automation bim management Jun 19, 2023

Manually numbering elements such as doors is boring.

By using Dynamo, you can automate the process. In this example, we have doors with random mark values unrelated to the rooms.

After running the Dynamo script, the doors automatically acquire the “To Room” value and add a unique letter suffix.

Before going through all the steps, check out Pamphlet #29. This free PDF guide contains everything in this post, plus extra information about the Dynamo player and renumbering furniture based on rooms and levels.

 

Watch the video version of this post:

                                                                                         

 

 

Step #1- Get all doors

Use the following nodes to get all doors in the project:

 

 

Step #2- Use “Door.Rooms” node from Clockwork Package

You will need to install a custom package called Clockwork. In Dynamo, go to the Packages menu and Search for a Package.

Search for Clockwork and click on Install.

The “toRoom” and “fromRoom” are not considered as parameters but as attributes. Regular “GetParameter” nodes don’t work to get the toRoom values. That’s why you must use the Clockwork node.

Now, place the Door.Rooms node from that package. This node gives you the fromRoom and toRoom attributes for each doors. Plug in the node called Select Phase and pick a phase in the dropdown menu.

You can try to run the script. You will see a list of rooms.

 

Alternative: Use Rhythm Package Node

An alternative to the Clockwork node is the FamilyInstances.Room node from the Rhythm package. When used with Doors as input, it will always return the toRoom value.

The Rhythm nodes are typically more stable than Clockwork because they are considered “no-touch nodes” coded with C# and don’t rely on “dependencies”. This jargon means you are less likely to get errors on various versions of Revit and Dynamo.

 

 

Step #4- Use the List.GroupByKey node

The List.GroupByKey node is one of the most powerful and helpful nodes out there. It will group the doors based on the “toRoom” attribute.

You can see the output. On the left, the list of all doors. On the right, the list of all unique rooms. You know the first sublist contains all doors in unique room ID=1196292.

 

 

Step #5- Create a Unique Sequence

Now, we need to generate numbers or letters that we’ll assign to the door suffix. First, use the List.Count node set at @L2 to count the number of doors per room. Then, use the Sequence node and fill in the input. In the example below, we use letter A for the start, but you could also use a number.

 

 

STEP #6: Convert Room Number to Strings

The “Unique Keys” output of the Group node returns the room element. But we need the number. Use the Room.Number node to extract the number in a string type. String means text in Dynamo.

On the left, you can see the original Room list (in yellow text). On the right, the room number in strings (orange).

 

 

STEP #7: Put Together the Unique Mark

There are multiple nodes to pad and concatenate a string value. But the easiest way is to use the Code Block node. You can create one by double-clicking on the screen.

You can create a variable by typing a text. Then, you can create a separator by putting text between quotation marks. Here is the Code Block formula:

You get a list of these unique strings:

 

 

STEP #8: Set Parameter Value By Name

Use the Element.SetParameterByName node. For the elements, plug in the “Groups” output from the List.GroupByKey node you’ve previously used. In this case, we set it to the Mark parameter, but you could use any instance parameter you want.

 

 

STEP #9: Run The Script

Try running the script! The doors should be renumbered with the unique number you’ve generated.

 

 

Addendum #1: Adjust From Room / to Room values

By default, the “To Room” value is always the direction where the door is swinging when the door is created. However, the attributes are not changed if the door is flipped after being created. That means you might need to adjust the values manually to get the room number you want for the door mark.

The best way to verify and change these values is to create a door schedule. When picking fields, use this dropdown menu.

Pick the Mark parameter, the From Room number and the To Room number. Your schedule should look like this:

When clicking on one of the From Room or To Room number, a dropdown menu appears. You can swap the numbers.

Adjust all values to fit what you need.

 

We’ve got more for you!

  • Learn how to use Dynamo to automate the FromRoom / ToRoom attributes.

  • Prepare the script for the Dynamo player.

  • Create a script that renumbers furniture based on both rooms and levels.

All of this is included in Revit Pure Pamphlet #29. Download the entire pamphlets publication with the link below.

33 Free PDF Guides About Complex Revit Topics

Pamphlets

Download the entire collection with this link. You will receive the 33 PDFs by email.

 

Recent Posts

BIM & Beyond - Vol. #1 - Fall 2024

D.TO - AI Details for Revit | BIM Pure Live #082

How to Make Great Revit Elevations