Even though Dynamo was created to be a programming environment for architecture, engineering, and construction professionals who don't have a background in programming, a new Dynamo user needs to learn a few basic programming concepts to become proficient. This video covers the most common types of data a Dynamo user will work with: numbers (which consist of doubles and integers), strings, and booleans.
- [Voiceover] Even though Dynamo was created to be a programming environment for architecture, engineering, and construction professionals who don't have a background in programming, there are a few basic programming concepts that you should understand in order to get Dynamo working well for you. This video is going to cover some of the most common types of data that any programmer, and now you, as a Dynamo user, will work with. The three most common types of inputs are numbers, strings, and booleans. Each of these nodes can be found in the Core Input section of the Node Library. Think of these inputs as the nouns of our visual program, which we'll later connect to verb nodes that are gonna perform functions on these inputs.
The number input, as you might expect, is a number. I'll drop in a number input by hovering over the Number node in the library, and clicking on it once. You'll notice that a number node is now dropped into our canvas. We can set whichever number we'd like to use as an input by clicking on the gray box that currently has a zero inside of it. By changing that number to whatever we want, say, a 5, and then clicking off in the background again, we've now changed the input of that particular number. Now let's see the data coming out of our number node by connecting it to a Watch node.
Think of the Watch node as a display of data output by whatever node it's connected to. We'll find the Watch node in the Core View section of the library. Just a little bit further down. I'll drop in a Watch node by clicking "Watch", and then connecting our number input to the Watch node. As you can see, the number that's coming out of our number input is a 5, as displayed in the Watch node. Now we can go ahead and change our number input again, we're not committed to the number 5. Maybe we'll change it to the number 12.
And I'll click off in space again, and now you can see the Watch node automatically updates to show the number 12. We can also type in decimals as part of our number input. Maybe I'll type in a 12.5, and again you'll notice now our Watch node updates to show not only whole numbers, but 12.5. A little something to keep in mind, when you're using Dynamo you might see certain nodes that ask for specific types of number inputs: Integers and doubles. Integers are whole numbers that do not have decimals, for example, the 5 and the 12 that we saw just a minute ago.
A double, on the other hand, is a computer science term for a number that does include a decimal, like 12.5. It gets the name "double" because it's a set of two numbers. There's a number before the decimal point, and a number after. If you see a node that looks for a double, it's asking for a number. Don't go looking for a double number input, we could just use our number input and you're allowed to use a decimal on that node. The next common input type is a string. A string is another computer science term. A string is a sequence of characters which the average person considers to be text.
Sometimes we'll see a string that's used to maybe populate a text parameter in Revit. Or maybe we'll use it to place notes on our architectural drawing sheets. Sometimes we'll also use it as a way of specifying the location of a file on your computer or your server. Let's head back up to the Core Input section of our Node library, and we'll drop in a String input. Similarly to the Number node, we can click inside of the gray box of the String input, and type whatever text we'd like to. Now let's connect our String input to a Watch node.
I'll copy/paste the one that's already on the canvas by selecting it, and typing Control C to copy it to the clipboard, and then Control V. Now you notice the Watch node is already hooked up to our number node, because we copied it from the existing Watch node. We can just click on the output of our String node, and replace the input from the Number node. And you'll see in our new Watch node that we're reporting "This is some input text", exactly what we typed into our String input. Now in the same way as the Number node, we're not committed to this particular input.
We can always click on the gray box and type something different. And you'll notice that the Watch node updates automatically based on the changes that we made to our String input. The last common data type is a boolean. Boolean is a data type that only has two possible values: True and False. We'll see that booleans are often used in Dynamo to ask questions about your data. For example, you might use a function that tests whether or not a window object's area is too big for a manufacturer to reasonably fabricate.
If the answer to the question is "Yes", the boolean value "True" will be returned, but if the answer is "No", it'll return "False". Let's drop a Boolean node into our canvas by clicking on the Boolean node under Core Input. Now unlike our Number and our String inputs, we don't have a box that we can type text or numbers into. Here we only have two options: a True or a False radio button. Let's copy/paste another Watch node to see the data that's coming out of our Boolean input. I'm going to hit Control C, and then Control V one more time to copy the Watch node again.
And we'll connect the output of our Boolean into the Watch node. As you can see, the Watch node returns the value of "False", because the "False" button is selected on our Boolean input. If we change that value to "True", you can see that the Watch node updates and we're now reporting a "True" value instead of "False". Now that we have a basic understanding of these common data types, let's put them into action with nodes that'll perform functions on these inputs.
- Placing and connecting Dynamo nodes
- Understanding Dynamo's data types
- Performing math functions
- Creating number lists and text strings
- Writing data to an Excel spreadsheet
- Creating points, curves, surfaces, and solids
- Analyzing geometry
- Linking a Dynamo-driven SAT into Revit
- Placing Revit families with Dynamo
- Creating Revit views and sheets with Dynamo