Randomize Revit Curtain Panels with Percentage using Dynamo
Mar 31, 2025
In this tutorial, you will learn how to create a Dynamo script to randomize curtain panels. You can adjust the percentage of panel types you want.
This tutorial includes a copy of the script and a sample file to test it.
Click here to download the script and sample file
Getting started with Dynamo? Want to automate even more stuff? Enroll now in the Dynamo Spacecamp.
Watch the video tutorial:
Inside Revit, place a curtain wall and create new curtain panel types. In this example, we have solid panels with different materials. The options are:
After this is done, you can create a big curtain wall with many panels to test the Dynamo script.
Open Dynamo. In this test, we're using Revit 2025.4 with Dynamo v3.3, but the script should work with any version and doesn't include any nodes from custom packages.
Place the Select Model Element and the CurtainPanel.ByElement nodes.
If you select a curtain wall and run the script, you'll get a list of all curtain panels in that curtain wall. In this example, we have 135 panels.
Now, create a node called Family Types. This allows you to pick a family type from the dropdown menu. In this case, we use the System Panel with the color name.
Afterward, copy/paste this node. You need a Family Type node for each option. In this case, we have 3 different options, so we have 3 different Family Types nodes.
Then, merge all these panel types into a single list using the List.Create node.
Now, create three Integer Slider nodes. Each node is matched to a curtain panel type. This will represent the percentage for each option. Ensure each option is in the same order as in the Family Type nodes.
You should rename the nodes to indicate the panel types. Then, merge the three integer values into a List.Create node. Ensure that the default values add up to 100.
It's time to do some math. We need to get a list the required number of each panel type.
First, let's build a fail-safe in case the user numbers don't add up to 100%. Let's add up the integer values using a Code Block Node.
In this case, you can see that the percentage adds up to 110 instead of 100. That's ok, we'll fix it.
Now, we need to count how many curtain panels there are in the curtain wall. Add a List.Count node and plug it to the CurtainPanel.ByElement node.
In this example, there are 135 curtain panels.
Add a new Code Block for some math. First, get the percentage value of each panel type. Then, divide that number by the "real" total percentage, which might exceed 100 if the user doesn't know how to count. Finally, multiply by the actual total number of panels that we have from the List.Count node.
The result is a list with the number of curtain panels for each color.
But you can see we're having too many digits. We need integers. Place a Math.Round node.
Now, we'll do some magician tricks with these lists. We'll Cycle, Flatten and Shuffle.
Start by placing the List.Cycle node. In the list input, place the 3 panels family types. In the Amount input, put in the Math.Round results.
For this node to properly work, you must adjust the list levels. Click on the arrows, activate Use Levels, and adjust to @L1 for both inputs.
The List.Cycle node duplicates elements by an amount specified by the user. In this case, the White type repeats 86 times, the grey type 37 times, and the black type 12 times.
We're still not done. This creates three sublists, but you need a single list. Bring in the List.Flatten node to have a single list with all panel types. You don't need to fill the Amount input, it will use the default value of 1.
Finally, let's shuffle the deck. This will randomize the order of the panel types in the list. Bring in the List.Shuffle node. The end result is a single list with all the panels types in a random order.
The final part is easy. Bring in the Element.SetParameterByName node. Put the Curtain Panels in the element input. The parameter name is Type. The values come from the List.Shuffle the node.
Run the script: your panels should be randomized!
Do you want control over the options you create? You can pick a List.Shuffle node that has a seed input. This allows you to control the randomness and return to an option you enjoy.
Bring in an Integer node and plug it into the seed. You will always have the same number and the same option.
Now, group the nodes and leave some indications for the end-users.
If you want users to use this script in the Dynamo player, you need to set some nodes as Input.
Right-click on a node, and check the Is Input option.
Activate this option for eight nodes:
Then, click on the Extension menu and slick on Show Graph Properties. Add a description, a image and a URL.
Try the script on the Dynamo Player. Users can play with this script without having to open Dynamo!
Enjoyed this? Join the Dynamo Spacecamp.
🔥 Save big: Get 20% off on all BIM Pure courses & content.
🧠 Get Revit Mastery: Access our full catalog of courses, templates, families, and live events.
Enter your details below to get this free guide.