This video shows how to create a floor type from a room parameter.
- [Instructor] In this video I'm going to show how to take the floor finishes work space even further with the help of a Dynamo package by making floor types based on a room's parameter. In the floors for multiple rooms work space Dynamo looks for a floor type based on the value in the room's floor finish parameter. If there's not a floor type to match the parameter value the script will produce warnings and not make any floors. In this video I'll show how to download a package from the package manager and use custom nodes to duplicate a floor type and set the structural layer materials of the new floor type.
Then I'll use sequencing to avoid errors if some of the floor types already exist inside of our model. Let's get started. In this Revit project I've pre populated the room finished schedule with room finishes for each of the rooms. Under the floor finishes I've used words like none if a room has no finishes inside of the room and per plan if the room has multiple finishes inside of the room. For these rooms I don't want to use Dyanmo to create floor finishes inside of the room. So I want to avoid them. Let's start by going to the manage tab and opening Dynamo.
Click to open the exercise file and browse to the chapter five oh five oh two begin floors Dynamo work space. Make sure to open it in manual execution mode and click open. This work space was set up to make floors inside of all the rooms whose room name contains the word toilet. I will adjust the filter to exclude rooms that have the word none and per plan. Start by removing the room name node and in the search bar search for get parameter value by name.
I can click to add the node to our work space. I'm going to wire the elements output from all elements of category to the element input of get parameter value by name. I'm going to double click on the canvas and in quotes I'm going to type floor finish. I click out. I can add the output from the code block to the parameter name input of get parameter value by name.
I can wire the var output of get parameter value by name to the STR input of the string contains node. In the code block where it says toilet between the quotes I'm going to type per plan. I'm going to pan up to the watch node and select it and right click and freeze it 'cause I don't want to make floors just yet. If I click run you'll see I have a list of two rooms and a longer list of the rest of the remaining rooms.
The list of the two rooms are the two rooms that have the word per plan for the floor finishes. I'm going to select all of the nodes that I used to filter out by the floor finish and move them over to the left to give myself more space to work. I can select the group of nodes and hold shift to select any additional nodes that I didn't pick up during my window selection. Holding control on the keyboard I can click and drag to copy the group of nodes over to the right of our filter by Boolean mask node.
I can wire the out output from filter by Boolean mask to the element input of get parameter value by name and the out output of filter by Boolean mask again to the list input of list filter by Boolean mask. Now what I'm doing is searching the list of all the rooms that do not include the word per plan in the floor finish to see if I have any floor finishes that have the word none. On the code block where it says per plan I'm going to select between the quotes and type the words none.
Now if I click run you'll see I have a list of seven rooms and a longer list of rooms that don't have the word none. I can wire the out output from the list filter by Boolean mask to the input of the watch node at the top of our work space. I'm going to select the group that says selection by elements and delete that. That was left over from using a manual selection method from the last work space. If I select the watch node I can right click and unfreeze it to allow the information to process through the rest of the work space.
I'm not yet ready to make floors, so I'm going to pan over to the right and select the floor by outline type and level node and right click and freeze it. This will stop floors from being made as we run through the information. If I click run, you'll see one of the nodes turns yellow. Yellow means warnings inside of Dynamo. If I zoom in I have a list of nulls and CT one and an element ID. This is the floor type by name node.
So it's looking for the list of the floor finishes and looking for a matching floor type. In this model I only have one floor type. If I look at the plan and go to place a floor you can see in the list of floors I have CT one and a few other structural floors. To avoid the list of nulls I'm going to go ahead and make a new floor type. To do that I need a custom node. Click on the packages menu and click search for a package.
Dynamo allows Dynamo users to upload their custom packages of custom nodes that other people can use. This is one of the things that makes Dynamo such a powerful tool. I'm going to search for the clockwork package and select clockwork for Dyanmo 1.x. If I click the download symbol and click okay through the error messages I'll download and install the package. The clockwork package has a few custom nodes that we're going to use in this work space. Go ahead and close the package manager.
Back in Dynamo there's a family type duplicate node. If I search for family type duplicate you can see that the clockwork package has a family type duplicate node. Click to add the family type duplicate node to the canvas. The family type duplicate node takes a list of family types and a list of names and duplicates the floor type naming it with the list of names provided. I'm going to sort through the list of our parameter values to find the unique items.
You can see that CPT one is listed three times at the start of the list. I only need to make on floor type for CPT one. If I search for unique items I can click and add the unique items node that will search through a list and provide me a list of all the unique items inside of that list. I take the var output from get parameter value by name and add that to the list input of unique items. Make sure to exit out of any active commands inside of Revit.
If I hover over the results of the unique items node you can see I have a list of seven items. Now I'm going to use the floor types node to look for a floor type inside of our project. From the drop down menu I can select finish floor. Now I want to create a list of finish floor repeated seven times. To do that I can use the cycle node which will take a list and duplicate it by the number of times indicated.
If I wire the floor type output of floor types to the list input of list.cycle I can find the number of items in my unique items list and duplicate floor types by that amount. In the search bar I can type count and use the count node to find the number of items in my list. If I wire the list output from unique items node to the list input of count and click run and see that there's seven items in my list. If I wire the INT output from count to the amount input on list cycle and click run again now I'll have a list of the floor finish floor type duplicated seven times.
I can take the list output from list cycle and wire that to element type on family type duplicate. Now I just need the name of the family type that I want to input. If I wire the list output from unique items into name I've taken the text value of all of the room floor finish parameters inside of my file and listed the unique items as the name for each floor type that I want to duplicate. I'm going to add a watch node on the output of out duplicate node.
If I wire the duplicate output to the input of the watch node and click run I can see the results. I've now created seven different floor types. Let's take this a bit further and make the structural material for each floor type. Again in the clockwork package there's a material duplicate node. In the search bar if I type material duplicate you'll find a material duplicate node from the clockwork package. I'm going to click and add it to the work space. Similar to the family type duplicate it requires a list of items and a list of names, only this time the items are materials.
I can create a list of materials by finding the structural material already applied to these floor finishes. If I use the get parameter value by name I could find the structural material. If I wire the output from the watch node to the input of element and on the canvas if I double click and in quotes type structural material I can click out and use the output of the code block as the parameter name that I want to get the parameter value of.
If I wire that up to the material now I just need a material name as an input for the material to duplicate. I'm going to use the element name of the floors that we've created to ensure that the list matches in order the list of the floor types. If I search for element name I can wire the output from the watch node to the input of element on element name and the string output from element name node to the name input on the material duplicate node.
I'm going to add another watch node to see our results. If I click run you'll see I get a list of nulls. That's because we've been running Dynamo several times. It already made the floor types on the previous runs. If I minimize Dynamo and go back into Revit I can click on the drop down on the undo button and undo the Dynamo scripts that have already run. Now inside of Dynamo when I click run I should see the list of materials that I've created.
Your list now only has one null item and that's at index one. If I browse back to our list of floors you can see that index one is CT one which was the floor type already inside of our file. The material duplicate node produced a null value because this material already existed inside of the file. Because we're creating floor types and we already have some floor types that are already created there's a sequencing issue that may prevent this work space from running.
The clockwork package has a custom node called pass through that's meant for sequencing. In the search bar type pass through and click to add the pass through node to your work space. What the pass through node does is waits for something to happen and passes information through it after the item has occurred. So if I wire the output of our watch node from the material duplicate it's going to wait until the material duplicate node has processed to pass the information through.
I'll pass the values from get parameter value by name through that list and now if I move our floor type by name node to the right of the pass through node I can right click on my node and remove it from the group to stop the rest of the group from stretching. I'm going to wire the output from the pass through node to the name input of the floor type by name node.
Now what I've done is told Dynamo to wait until the floor types and materials have been made before looking for the floor type that matches the floor finish parameter name. If I select the floor type by outline type and level node and right click and unfreeze it I can click run and see that I've made 196 floors. You'll notice that there's some nulls inside of this list. Nulls mean that the boundary of a room was unable to make a floor.
Some rooms are not placed. Some rooms are redundant rooms where one room's inside of another, or some rooms have geometry that is too complex to make a floor from. You may want to try to use this as another method of filtering. For rooms that are not placed or redundant they do not have a square footage. If you filter by the square footage that is greater than one square foot you'll remove those rooms from your list. The challenge with using Dynamo is deciding when to stop automating things. It's important to find a fine line between avoiding warnings and creating an overcomplicated Dynamo work space.
Leveraging Dynamo to make floor types based on the text input is something that can save a ton of time while promoting consistency in how family types are made. This is worth the extra nodes added to the work space. As the work space grows it is important to be aware of how long it takes Dynamo to complete a script. If a script has become too long to complete in a reasonable amount of time you may want to reconsider how much you are having Dynamo do versus how much you do yourself.
- Finding curves and points in Dynamo
- Creating a list for organizing elements
- Modeling walls and floors
- Working with multiple rooms
- Creating a graphic finish legend
- Creating a material take-off
- Creating graphic overrides
- Updating room parameters
- Creating a floor type from a room parameter