17.1. What is Dynamo?
Dynamo is a visual programming platform for Revit. Typically, programming is done with text. Visual programming replaces code with nodes and wires instead. In the end, you can achieve the same result by building a custom add-in than a Dynamo script. In the image below, the Visual and Textual programs both accomplish the same thing.
In this chapter, we will focus on modifying parameters and information. Dynamo can be used to generate geometry, but these features are usually more complex. We’ll focus on the simple stuff first.
In this chapter, we will focus on modifying parameters and information. Dynamo can be used to generate geometry, but these features are usually more complex. We’ll focus on the simple stuff first.
DYNAMO TERMINOLOGY
Open Dynamo. You will find the tool on the ribbon, in the Manage tab.
Here is the basic terminology of Dynamo. Nodes are the little boxes you keep seeing all around. We’ll use that word a lot.
Here is the basic terminology of Dynamo. Nodes are the little boxes you keep seeing all around. We’ll use that word a lot.
CONNECTING NODES
The core idea of Dynamo is to connect nodes using wires. That’s what we do in the image below.
RENAMING NODES
Double-click on a node to rename it. Renamed nodes will have a yellow “Renamed” tag alongside the name.
NODES LIBRARY
On the left of the interface, you’ll see the node library. They are divided into multiple categories. The nodes that interact with Revit are part of the Revit category. The search bar is essential to find your way around the huge number of nodes.
CUSTOM COMMUNITY PACKAGES
A strength of Dynamo is the active community which keeps providing additional nodes for free. Go to the Package menu and select Search for a package. Some packages are essential for a great Dynamo experience. More on that later.
INPUT NODES
Input nodes are essential to get your script started. They are used to define specific numbers, text, file path, yes/no and much more. Here are some input nodes you’ll encounter:
CREATING A NOTE
Some scripts can become an insane spaghetti festival. Adding notes to the script helps other users understand what’s going on. Go to Edit and click on Create Note.
Then, type in whatever you want and click Accept.
Then, type in whatever you want and click Accept.
CREATING A GROUP
Notes are okay, but groups are better. Select multiple nodes and notes. Then, right-click and select Create Group.
Check out this awesome group:
You can show a group color by right-clicking it. Multiple colors will be available. When creating big scripts, use a strong color code to keep things easy to manage.
Check out this awesome group:
You can show a group color by right-clicking it. Multiple colors will be available. When creating big scripts, use a strong color code to keep things easy to manage.
MANUAL MODE VS AUTOMATIC MODE
The Automatic/Manual option is located at the bottom right of the interface.
Automatic mode will run and rerun the script each time you modify it. This feature is the default mode in Dynamo but is probably not convenient for you. Automatic mode often executes scripts before users are ready to do so. You can potentially cause problems to your model if you aren’t careful.
Instead of Automatic, switch to Manual instead. When you want to activate the script, click on Run. Regardless of which mode you are using, create a test model before using your script on an important Revit model.
DYNAMO PLAYER
Some users are terrified of opening Dynamo. That’s ok, they can use the Dynamo Player to run the script, and they’ll never face the spaghetti. You will learn more about the Dynamo Player in the coming pages.
CREATING A SEQUENCE
That’s enough with the interface; let’s create something.
Add a sequence node. Use the right-click menu and type in Sequence.
Hover your cursor over one of the input ports. You will see a pop-up that explains what that input does and what input type the node expects—hovering your cursor above the entire node will explain how to use the node.
ADDING INPUT NODES
Let’s explore a few ways to create input. The universal Dynamo node is called Code Block and can be used for multiple things. You can indeed type in code but also type in values. To create a code block, double-click anywhere on the screen.
In the example below, we type numbers. Press Enter to create multiple lines on the same Code Block. Plug the wires.
Code Block has some limitations. One of them is that the values entered here can’t be customized in the Dynamo Player.
Code Block has some limitations. One of them is that the values entered here can’t be customized in the Dynamo Player.
NUMBER VS INTEGER
The Code Block alternative is to use a Number or Integer node. If you remember your math class, an integer is a number that is not a fraction.
USING A SLIDER
When creating numbers or integer input, you can use sliders. Click on the arrow symbol to adjust min, max and step.
Let’s plug that slider into the sequence!
EXECUTING THE SEQUENCE
Execute the script. The sequence is generated. Hover your cursor on the node, and you’ll see a List pop-up. Go to the list and click the Pin icon to see all items on the list permanently.
USING A “STRING”
Time for some programming jargon: string means text.
Create a string node.
Type in a letter. As you can see below, the script now creates an alphabetical list instead of a number sequence.
This specific type of entry only accepts a single letter, but other nodes will allow you to use as many words and letters as you want.