説明
主な学習内容
- Understand the basics of the DesignScript syntax and how to use it
- Learn how to perform MEP calculations with Dynamo using DesignScript
- Learn how to input parameter values based on criteria in the model
- Learn how to create graphs that can automatically select equipment or components
スピーカー
- Jason BoehningJason is passionate about helping people and organizations in the AECO industry. As a trusted consultant, he has helped organizations implement digital technologies to improve processes and deliver exceptional results. He has made a career of helping building professionals use digital tools to increase productivity for sustainable design and construction. Jason speaks at events and conferences all around the world. He is a repeat, top-rated speaker at both BILT North America and Autodesk University. Jason is a member of the Autodesk Expert Elite program and is an Autodesk Certified Professional for Revit MEP Mechanical, Revit MEP Electrical, Revit Architecture, and Revit Structure. He also served as an Autodesk Revit Mentor All-Star.
JASON BOEHNING: Let's go ahead and get started. Welcome. Thank you for being here. This is Dynamo DesignScript for MEP.
My name is Jason Boehning. I'm the Building Content Manager for 4D Technologies. I helped develop our CAD learning products. So we create learning products, learning content for Autodesk products, just to help people learn and be productive using the tools Autodesk provides. So the main ones that I oversee are for building design such as Revit and Dynamo and Inside and any other building design tool.
So along those lines, CAD Learning is having a little giveaway here at AU. There should be a poker chip on your seat, on your computer, somewhere. And anyways, if you sign up for a 30 day trial all free, you'll be entered to win a 3D printer. It's a mini or micro-- so it's a small one. But anyways, if you'd like to do that, you're more welcome.
Well this is a lab. I really like labs because we're able to walk through it together. So it's one thing standing up in front of a group and trying to explain Dynamo, but it's another thing allowing you guys to have a computer and walk through it with me. And I think it's extremely beneficial, especially with learning Dynamo.
So we're going to start out with a few basic introductory stuff, and then we're going to jump right into our lab. So we have 90 minutes this afternoon. So we've got a lot to cover. And I'm excited. I'm looking forward to it.
So we're going to look at some simple getting started exercises. And then we're going to look at the list at level functionality, because it's extremely important in Dynamo. And then we're going to look at basically three things kind of all intertwined with these last three in kind of some form or fashion. But basically, we're going to look at performing calculations, setting parameters, and setting family and types. And then we'll wrap it up and we'll move on.
So just a couple of quick introductions. I kind of want to get to know you guys. Especially when teaching an MEP class, MEP is not just one group of people. It's so diverse. So how many mechanical folks do we got?
OK, great. What about electrical? OK, plumbing specific or kind of mechanicals kind of take care of that too? Awesome. One more thing, who is using Dynamo?
Who has never opened Dynamo? Got a few? OK, great. Would anybody say man, I'm a Dynamo power user. I'm writing my own packages. I got this all figured out.
Anybody? Yeah, well, you guys should be teaching this class then. We're going to kind of start out basic, and then we'll ramp up. So if you would consider yourself a Dynamo user, or even an expert, just hang on with us for the first couple of exercises before we really get rolling. Because this is what I would call an intermediate class.
I don't think there's really a beginner Dynamo class. You've got to know Revit to begin with. I needed advanced Revit and beginner Dynamo is kind of what I was looking for, but you can do that. So I chose intermediate.
But anyways, final note, if this is not for, if this is like this is not what I was expecting, you're not going to hurt my feelings if you get out and leave and go find another class. I know your time is valuable and your money is valuable. And the next 90 minutes you want to get something out of this.
So you're not going to hurt my feelings if you get up and leave right now. Maybe in 10 minutes, it'll hurt my feelings and I won't be able to continue. Just kidding.
So let's start out. What is DesignScript? So essentially DesignScript is Dynamo's programming language. It's essentially the backbone of Dynamo. So everything is built off of DesignScript nowadays.
So if you're somewhat familiar with Dynamo, you know that you place nodes and connect nodes, and that's how you create a Dynamo program. But you can also manually enter code. But regardless of whether you're placing nodes or entering code into a code block, you are using DesignScript.
Everything is built off of DesignScript. So when I was creating this class, that's kind of what I was like, let's just start with DesignScript and kind of take a look at that. Because I think if you understand that, it helps you understand Dynamo.
Let me introduce-- we do have three lab assistant. So if you do get stuck somewhere along the way, we have our three lab assistants. We can wave, everybody. They'll come around and help you out.
Anyway, trying to explain to somebody what Dynamo is good for, it's like, well, how can I explain what Dynamo is good for? It's like, how do you explain what water is good for? It's good for just general health. Dynamo helps with just general health of a model.
Water helps clean up messes. Dynamo can help clean up messes. It's so diverse, so many different uses. And so what I want to try to do is expose you to lots of different methods, lots of different ways to do things in Dynamo.
So you've heard me mention a code block already. So what is a code block? Essentially a code block is a node that allows you to manually enter Dynamo language or code or DesignScript.
And so you're manually interacting with DesignScript. So it's very versatile, very flexible. So we're going to focus a lot on those today.
So let's jump right into this. And we're going to look at a getting started exercise and look at some of the DesignScript basics. So if you could open up Revit-- and I'm going to actually be using my personal computer here-- so if you have it open on the C drive under data sets, and then-- let me pull it up real quick here. So if I'm not mistaken, make sure it's the data sets folder, lowercase d and plural data sets. And then Jason Boehning, and then Dynamo DesignScript, and then data set.
And you should see seven exercise files folders. Everybody see that? Anybody not see that?
Raise your hand if you're not seeing it? Can we get somebody here? Anybody else not finding the exercise files? OK, perfect.
So to open Dynamo-- just in case you've never opened Dynamo before-- it's now inside of Revit. So on the Manage ribbon, over here on the visual programming panel, you can click Dynamo. And that'll launch Dynamo.
So important thing to understand is that when you're working in Dynamo, your Dynamo file or graph, it needs to be tethered to a Revit project. So best practice is to have one Revit project open and one Dynamo file open. That way you can make sure they're connected or tethered together. If you have a bunch of Revit files open, basically Dynamo could get lost in there.
The next thing we're going to want to do is open up exercise one, underscore start.dyn, which is really just a blank file. Everybody there? Not quite. OK, I'll give you guys a little bit of time.
So what we're going to look at in this first exercise is basically DesignScript syntax. I'm hearing a lot of chatter. Were we having problems finding it?
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: I'm sure all the labs right after lunch kind of hitting the server and bogging it down a little bit. We good now? So like I said, what I want to do right now is focus on some DesignScript syntax.
It's extremely important that you understand the basics. You've got to walk before you can crawl. [GIGGLE] You got to crawl before you can walk. I'm sorry. I butchered that.
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: Yeah, you've got to jog before you can sprint. Let's put it that way. I don't know. Anyway, OK. Enough of my lame jokes here.
So if you double click the canvas, or basically the drawing area if you're used to Revit-- the drawing area here's what we'd call the canvas in Dynamo-- when you double click, you're going to have a code block. And inside a code block, there's lots of things you can enter. We're going to start out by looking at numbers and text strings.
So if you want to enter a number, simply type the number. And you can click outside of it, and then it's going to place a semicolon here. Basically, every command line in a code block needs to end in a semi-colon. And so you can enter that or Dynamo will do it for you automatically.
Let's look at one more thing. So if you want to place a text string, you have to place the inside of quotation marks. So I'm just going to say parameter name. Put it inside quotation marks. And then once again, you can add that semicolon.
And then for you beginners, pay attention to this bottom left corner here. Right now we're running in what's called automatic mode, meaning it's continually running the program that you have in your canvas. You can change it to manual. When you do that, then you have after you do something, you need to manually click Run.
If you're still getting started in Dynamo or if you're like exporting something from Excel, you should be running in manual mode, otherwise, if you connect something up incorrectly, you're going to send it into this infinite loop and it's going to crash. For this example, I'm going to keep it at automatic.
Moving right along, I can also enter multiple command lines into a code block. So let's say I have some air flow values-- so I'm going to enter 200, press Enter, and I have a new line. And I'll just do 250, 300.
Every time you press Enter, you create a new line. But make sure that you have a semicolon if you want to in that command. You can also enter text right in there. For example, [INAUDIBLE] to flow, CFM, and so on and so forth.
So as we do that, you can see that instead of just having one output here, we now have multiple outputs. So basically a code block is great for just storing a bunch of information. If you want to put a bunch of data in there, a bunch of parameters, you can just put multiple commands in there.
Everybody with me so far? Simple? The next thing we can do is we can create formulas. So if you want, you can manually enter something like 3 plus 4, and then we'll end up with 7, obviously. So you can perform some calculations in there or even better, you can add variables.
So next what I want to do here is type a plus b. And in this case, I'm entering text, but I want to use those as variables. So don't put those inside of quotation marks. So when I do that, I end up with an a and b input.
Now we can use something like a slider, a number slider. And if you want to, just up here in the node library just type slider. And then you can place a number slider or even an integer slider. I'll just show you a quick example here. So now when I connect these up, just click the output and then click the input, and I have it running.
Also, when you hover over a node, there's a little preview bubble that appears, and then there's a pen icon. You can click that pen icon to show your output. Now as I slide through my slider, I have a parameter here inside node. And so we'll get into some actual examples here in a minute. Like I said, I want to focus on the basics for about 10 minutes and make sure we understand that.
Next, we can also create what we call ranges. We can create a basically a list of numbers. There are several instances where you just want to generate a range of numbers.
Maybe you want to generate 1 through 100 to name spaces. Or maybe you're using it for airflow values or whatever it may be. So let's take a look at that syntax.
So I'm going to double click the canvas again to place another code block. The most basic form is put in a number, your start point, dot dot, and then an end point. In this case 1 dot dot 10. That's going to get me a range of numbers from 1 to 10 incrementing by 1. If I want to increment based on another value, for example, if we want to go from 100 to 150, I can do another dot dot and then place what I want to increment by.
In this case, I'll do 5. So now I have a range of numbers from 100 to 150 incremented by 5. Another way to do it is if you just want to specify the number of values you want in that list-- so let's say I want to go 2 dot dot, and then I want 10 items in my list-- so 2 dot dot number sign 10 dot dot 2. I want to increment by 2.
Now what I'm going to end up with is a list starting at 2, incremented by 2, and I'm going to have 10 values. And then last one here, instead of putting the number sign in that middle position, I can do it at the end and then control how many items, in order to specify how many I want in that list. So for example, if you want to control the start number and the end number, and then specify the number of items in that list, put the number assign value at the end. Now I have a list from 1 to 10, with five items in that list. Everybody with me so far? Awesome.
One more thing I want to point out-- as you can see these lists here, they are numbered. You can see the actual values, but then you can see what's called the item number or the index number. And the index always starts at 0. So that's important to understand.
So if you want to get the second item in the list, that's actually at index 1. So we'll get to there in a minute. But I just want to point that out. All lists in Dynamo start at index 0.
Moving right along here. Once again, still covering some of the basics. Now if you want to create a list directly inside the code block, you can do that too. If you want to manually enter values or parameters, whatever it may be, you can do that directly inside a code block. So in this case, let's say we want to put some airflow values.
So start out with a curly bracket, and then let's just do like 200, 250, 300, 350. And all these values are separated by a comma. When I do that, I manually create a list. Simple enough? Inside curly brackets.
If you want to nest that list, just put it inside more curly brackets. So when I do that, when I click out, pay attention what happens here. So right now I have this list, and then my values. I click out. Now I have a nested list.
And so once again, I want to kind of pave some of the framework here. And then we'll move on to some actual examples where we can use this. So I'm going to take that back out so that I just have a single list there.
And now if I want to extract a value from that list-- so let's say we end up getting a list of values from Revit and we want to extract something. I can basically input a parameter here, whatever I want to call it. In this case, I'm going to call it air flow.
And then I'm going to place a square bracket. And I remember what I said about those index numbers, if I want the third item in that list, what index is that of? Two, exactly
So now I have an input. And when I connect that up, my list here of air flow values, I can grab that third item in the list, which is at index 2. And one more thing here along these lines, if I want to get a range of values, use that dot dot terminology. So if I want to get items at index 2 through 4, just put 2 dot dot 4, and now I get 300, 350, 400. Everybody good so far?
Last thing I want to cover here in our basic example is that you can call nodes inside a code block. So remember what I said about DesignScript everything's built on DesignScript. So whether I'm placing code into a code block or I'm placing nodes, I'm using DesignScript. So if I want to use the know terminology, which let me just show you an example here real quick. So you don't have to do this, but let me find this.
So here's a node. So this is the list dot contains item node. If I want to call that node inside a code block, I can basically just begin typing what's here in the node title, if you will. So list dot contains items. And so list comes from what I would call the category of node.
So we have core nodes and then you have list. And then you have all these nodes. So when I type list, you can see there's a category. And so when I can do list dot, it pulls up all these nodes. So these nodes are the same those that are over here in the node library.
They're not organized exactly the same but you can keep typing or you can use arrow keys to select it. So I want to do list dot contains item. Now I basically call that node inside a code block. And then now I'm showing you this because it's it can be useful sometimes. But for some of them, the syntax after that can be a little more difficult.
But this one's pretty simple in that all I need to do is basically a parameter, and then the value that I want to check for. And so once again, air flow, and then I to see if it contains this item right here. Connect it up and it gives me a Boolean value, which in this case is true. So my point there, I just wanted to show you can call nodes inside a code block, but after you do that and you're in you're working inside your parentheses, the syntax is different based on the notes. So it's sometimes it's just easier to use the node.
But as you become a power user and you're just coding away, you can start to call those up. Make sense? Anybody have any questions? Awesome.
So a quick note here, all this information is in the handout, which the handout is available on the app. And it's also available on the data sets sets folder, which you will get probably after AU at some point. They'll send out an email, or I don't know exactly how they'll get it to you. But all this is in the handout. We spent a lot of time documenting everything.
Let's go ahead and close this. You can click in the little tab showing the exercise file. You can click the Close button. Don't save any changes. And we can keep the same Revit file open, because it's basically blank.
Now go into exercise 2, exercise 2 underscore start. I'll give you guys a minute to get there. Once again, we're starting out in a blank file.
So what I want to do here is show the list dot level functionality. But what I also want to do is show you how to import an Excel file along the way. And that's important because we can keep track of a lot of information inside Excel files, and then we want to import that information in.
So real quick, let me just show you. Sorry, I should have had this pulled up. So here's the Excel file that I'm going to import in. So basically what I have is a sample list here. Spaces, the zone that it belongs to, and then an air flow value.
So we're going to import that information into Dynamo. And we can do that with the Excel dot read from file node. So now let's start digging into the node library a little bit.
So as you can see, there's all these categories here. And when you expand Office, there's a read from file and a write to file node. So click Read From File and you can see we need to specify a file, a sheet name, and then this one is actually optional. You can choose whether or not what you want to read it as strings.
And once again, strings are just text. So if you're importing numerical values, you don't want to do that. And the default value is false, so I typically don't mess with that.
Now we need the file path and the file dot from path node. So when you open the node library in this search field, if you type file, you'll likely be able to find both of those. So there's the file path, and then the file dot from path. So once again, just place those here on the canvas. And this file path node has a browse button.
When you click Browse, it's going to open up an open dialog, and you can go navigate to the location on your system. And it's that exercise 2 dot Excel SX file. And hopefully, the Dynamo file should open directly to that location.
Now what I want to do just connect those up. And then we need to specify the sheet name that we have in Excel. In this case, I'm just using the default Sheet 1. And it's important that it's case sensitive and it must match exactly. So sheet 1 with no space.
And once again, since it's a text string, I need to put it inside quotation marks. And then like I said, if you're going to import from Excel, it's usually smart to keep it in manual mode. Because let's say you specify the wrong information and it just start to churning and you end up in this infinite loop. So once you have that, you can click Run.
And it's going to open up that Excel file for you. And so you can see the Excel file that you imported from. And then when you expand the output of this node, you can see the information that we have. So take note that each row here in Excel was imported as a nested list. You see that?
So in each row, we basically had a space and then some space parameters. So each row comes in as a nested list. So that's how you import from Excel. Simple enough, right?
Now let's go back into the node library and search for get item. You're going to see this get item at index node. So this is important when you have a list, and then you want to get some data out of a list. You can use the list dot get item at index node. So just for sake of example, let's connect the data output here to our list input.
And then let's just use index 0. So put a zero in your code block there and connect that up to the index. So now when I run this, you can see that I get that first nested list. Because basically what I'm inputting-- the way that Dynamo works is it's inputting this list, and is working on it from the outside in. So index 0 here is this first nested list.
And so I basically end up with that first space. But what I really want to do is kind of work from the inside out. So in order to do that-- it used to be very difficult. But now with a list at level functionality, it becomes a lot easier. So pay attention to these little buttons here just to the right of the inputs. On this list input, click this button here. And there's a use levels option. When I click Use Levels, basically I can choose the level that I want to work with.
So let me scroll down here to this list that we imported. Can you see the at L1 at L2 and at L3? So that's basically saying I have three levels that I'm working with. Level 1 is all the information. Level 2 are the actual nested lists.
Level 3 is the list of nested lists. So if I want to work at L2-- actually, I'm going to change this to automatic now. So I'm running automatic. So now when I worked at L2, which is basically my nested lists, and I am getting the item at index 0, I'm getting the first space in each nested list.
And if I change this to index 1-- it's running automatically-- now I get the zone parameter. If I change it to 2, I get the airflow values. So typically that's what you want to do. Because when you typically don't want to work with all the information that you have-- or maybe you do.
Maybe you just need to get one space-- but usually what you want to do is get all the air flow values or all the load information, whatever it may be. And so that's the list at level functionality. You get a question?
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: I'm sorry. Can you say that list both--
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: Oh, so the question is can you do at level 1 and at level 2? You can't do two at the same time. Does that makes sense? The list at level functionality? Everybody good?
No? I'm seeing some heads shaking no. Can you guys raise your hands? Get somebody over there.
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: Oh really? OK. Anybody having problems with Excel? I know there were some licensing issues earlier, maybe that's causing some issues. Does everybody understand the list at level functionality? Does that kind of makes sense?
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: So the question was, was there a different way to do it? And you could use the list dot map functionality to kind of map it in. And it was really confusing. But now the list at level functionality really helps that. Let's move on to exercise 3.
So I'm going to close this. And this time we do need to close this Revit file as well. So now let's go to navigate to that data sets folder. Exercise 3, and then exercise 3 underscore start. And as I'm sure you've noticed, I have start and final files.
And so especially with these next three, if you do get lost along the way, you're more than welcome just to open up that final file and continue right along with us. So in Dynamo let's open up exercise 3 underscore start dot dyn, which is also a blank file. I'm going to make you guys work this afternoon. So as you're doing that, let me kind of explain where we're going with this example.
So especially on the mechanical side, you place all these air terminals. And then you need to specify flow values for the air terminals. Well, if you're running loads, you know that the amount of air flow that's needed in a space can be input into that space parameter. And so once you have that, then you also know that space is recognized when air terminals are placed inside that space. And we can use Dynamo to also extract that.
So basically I'd have this just kind of proof a concept exercise file where I have different numbers of air terminals in each space. And I have air flow values here. So I have tags here. So S is the space specified airflow. So you can see that there.
And then the A is the actual supply airflow which is coming from the air terminals. So you can see right now that they don't match. So typically what you do, or at least what I've seen a lot of people do is they would have somebody go in there, see what the air flow is, and then set it for all the air terminals. For every single space, they'd go through there and do that. Or they'd create a schedule and then do it in the schedule.
What we're going to do is we're going to basically select the spaces, select the air terminals, see which air terminals exist in which space, get that space specified airflow, divided by the number of air terminals, set the flow based on that number, and we're good to go. OK, sorry. I was being facetious there. That's what we're going to do. But we're going to walk through it a lot slower.
So in Dynamo, I like to say it kind of simplify things. There's basically a three step processes in Dynamo. You're going to select elements, you're going to perform some type of task, and then usually you want to write that back to Revit or set parameters inside of Revit. So you kind of keep that mind. Three steps is kind of what I want to do.
As you get more advanced, there's a lot more involved. But if you kind of keep that in mind-- you need to select elements, perform some type of task, and then go set parameters. So in this case, I want to select the spaces, and then I need to select my air terminals. So in the node library, let's expand Revit selection. And I'm going to select these spaces by category.
So there's this categories node. Let me zoom in here. And then I need this all elements of category node. So you can also select elements by family type or by element type, but depending on what it is, usually categories is a good way to go. So when I expand this dropdown in the categories node, I can begin typing.
And it's going to filter my list here. So find spaces. And then right now, I have it set in manual mode just so nobody breaks anything. When we run it, I can see those four spaces that I have selected. Let's also place another categories node in the all elements of category.
And let's go find our air terminals. And then let's connect those up. So when I run this, you can see that I have all the spaces selected and all the air terminals selected.
So now I have a list of spaces and a list of air terminals. Everybody with me so far? Categories-- all elements of category.
Next, in order to do some kind of comparison to see which air terminals exist in which space, I'm going to create geometry for each of those elements, and then I'm going to intersect that geometry. And when I do that, Dynamo is going to be able to tell which ones intersect. And then we can use that to find out exactly which ones we need. So up here just type in the node library in the search field, element dot geometry. And as you're typing, it should pop up there.
So when you use this element dot geometry node for my spaces. And then for the air terminals, I'm going to use what's called the family instance dot location node. So begin typing family instance, and you should see down here, location. It says family instance, and then that titles location there. So family instance dot location.
Connect that up to the air terminals, and run it. And you're going to see some geometry in the background. So those are our spaces.
And then you can see the point locations of the air terminals. Everybody with me so far? Give you one second there to catch up.
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: Yeah. So the question was can you select specific next sizes of air terminals? Yes you can. For this example, I'm kind of sticking to the basics. The next one, I'll show you how to get more detail. You can select an actual type.
There's several ways to do it. In this case, I'm just selecting them all, just to kind of get you rolling here. I'm hearing a lot of chatter.
Who's not with me yet? Got a few. It's hard to see? Yeah, I'm sorry. So the handout is on the app. If you can pull that up, that could be helpful.
AUDIENCE: [INAUDIBLE]
JASON BOEHNING: Yes, element dot geometry. If you can see it there. Are we having a lot of problems? Let's continue on.
So one important thing to understand here, in this element dot geometry node, you can tell that each solid is in a nested list, whereas in the family instance dot location node, they're not. So that's important to pay attention to. And this node does it by default.
All I want is a list of the solids. So what we want to do is flatten that out. So search for the flattened node. And when we connect that up to the element dot geometry node, then we'll just flatten it out. And we just have a list of solids which is what we want to work with.
Now we have a list of the geometry for our spaces and a list of the point locations for the air terminals. Now we can use the geometry dot does intersect node. So just begin typing does intersect, and it should pop up there relatively quickly. And we want our space geometry to go into the geometry input. And then the family instance dot location to go into the geometry dot does intersect.
So while you guys are getting to this point, let me explain what's called lacing. So when you right click a node, you can access lacing options. There are three lacing options, shortest, longest, and cross-product. And let me demonstrate those for you. So when I have shortest and I run it, I end up with a list of four values.
So basically Dynamo is calculating the information in the node based off of the shortest list, which in this case is the list of four spaces. So what it's doing is it's taken that first space and the first air terminal and saying do these guys intersect? True or false? Second area terminal with the second space, do they intersect? Third, so on and so forth until the shortest list is used up.
So that's obviously not what we need. That does not help us at all in this case. In most other cases, it's fine. In longest-- if you could pay attention there in the node-- this little one line means the lacing is set to shortest. Now when I change it to longest, you can see two straight lines and then one angled line.
Now when I run that, I'm just kind of doing the same thing with that shortest list. But then when you still have more items in that longest list, it's going to take the last item in the shortest list and use that with all the items in the longest list. Which that's not what we need either. In this case, we want to check every single air terminal with every single space.
So we can use the cross-product lacing. And now when we run that, what we end up with is a nested list for each space containing Boolean values for whether or not that air terminal exists in that space. Now we're starting to get somewhere that can be beneficial to us.
Now let me take a quick pause here and explain a couple nodes. So the list dot filter by Boolean mask node is very versatile and it's very useful. I use it quite often. Think back to where we are. We have a list of Boolean values that we somehow need to get in the way that works for us.
So we can input a list, and then we can input a mask. So think of it this way. If you're painting, and you've got fumes in the air, you put on a mask so that only the good air comes in. You just want good air in.
This case, the mask is Boolean values to Boolean mask. True or false? You only want true values in. That's kind of way that I use to help recognize the in, the out. We want to keep the bad air out, so the air that's false if you will-- the Boolean values that are false are going to go in the out.
So I'll show you a quick example. So if I have 1, 2, 3, 4, true, false, true, false, I'm going to have 1 and 3 2 and 4 matching up with this Boolean mask. Simple enough?
This next node is the list dot map node, which I kind of referenced earlier. This node is extremely powerful and it can do a lot of different things. And basically, what you do is you input a list, and then you just need to input a function.
And you need to tell Dynamo what type of function you want to perform on that list. And I'll show you here an example of it. And we're going to use a function.
So now we have all these Boolean values. So if you search for filter by, and then this filter by Boolean mask node should pop up-- and then also search for list dot map. And then we'll place this one over here.
And I know I just told you we needed a Boolean mask, but we're going to do it a little bit differently. I'm going to take the Boolean input. I'm going to put that into my list. And now I'm going to use the filter by Boolean mask node as a function. So when I go back over here, I need the actual air terminals.
So here in the all elements of category node, I'm going to take that output and bring it all the way over here to the list input of the filter by Boolean mask node. Let me move these out of the way to help you see. Can you guys see that? So when I have a node that doesn't have all the inputs, I can use it as a function. So in this case, basically what I'm doing, is I'm going to use this in output to connect up to the function here.
So basically, the function that I'm telling Dynamo is I want air terminals whose values are true. And trust me, if you're new to Dynamo and you're like, I have no idea what you're talking about man, like, I get it. I've been there before. You'll have all of these data sets. You can play around with it a few times and it'll start to make a little more sense as you go.
But just trust me for right now. So once again, I'm putting in this list of all these Boolean values. And now I end up with a list of air terminals nested in a list based on my spaces. So now I have the air terminals that exist in each space.
Now what we need to do is we need to determine the airflow value that we want to use to set the flow value for those air terminals. So what I want to do is place a code block down here. And just for sake of example, let's do flow equals-- I'm going to do SSA, space specified airflow, divided by ATS, air terminals per space. You can spell it all out if you want, just to help reduce a bunch of typing. Basically, if you remember, each string of text that you import is going to become a variable.
The next thing I want to do is search for the count true node. So if use search count true-- because what I want to do is I want to know the number of air terminals that exist in each space. So I'm going to take that from the geometry dot does intersect because this is where I had all these Boolean values. And I just want to count the numbers that are true. And change the lacing here to longest to make sure that you collect everything essentially.
And then the next thing we want-- and I'll slow down here a little bit. So in the node library under Revit, Elements, Element, where did we go? I'm showing you this because there's lots of important nodes here. There's the get parameter value by name node, and then there's the set parameter by name node. On the MEP side, these nodes are used in pretty much every graph that I create, almost.
So let's do the get parameter value by name node. And then I'm going to place another code block here. And I'm going to put specified supply air airflow inside quotation marks. And that's obviously the parameter name that I want. And then the elements I want those spaces.
So I need to come back all the way up here to the-- so we have categories, all elements of category with our spaces-- so take that wire and connect it all the way down here. I hope you guys can see that. I know the screen's may be a little difficult to see. So once again, I have my spaces here. Make sure that's connected all the way down here in the element dot get parameter value by name.
And then I'm going to connect this up to the space specified airflow flow, or SSA, just for sake of example. And then I'm going to set this lacing right here longest, just to make sure that I'm calculating everything. And then the count true is going to go into the air terminals per space so that I can get the number of air terminals in each space. Now when I run it, I should have four values, which is the airflow values. And I know these numbers look a little off. I'll discuss that in a minute.
Now we have the air terminals that exist in each space. And we have the airflow values that we want to use to set the flow parameter for the air terminals. So we can use that set parameter by name node so that we just showed you a minute ago. So pop that down onto the canvas.
And then we're in the list dot map node. That's where our air terminals are nested in lists based on the spaces. So that's my element input. And then the parameter name is going to be flow.
Once again, input that inside of quotation marks. Connect that up to the parameter name. And let me move this down. I don't know if this will help you. If it helps with the white background.
And then here are my values that I want to use. Now when I run it, we don't really see much happen. We get the same list over here telling us that it's set. Those are the elements that it set the parameter for. So when I switch back over to Revit, my values here now match up.
So the space specified airflow now matches the actual supply air flow. And you can see that the flow for the air terminals have changed in those spaces. Make sense? [WEAK APPLAUSE] Thank you. Thank you. Thank you.
If you are having trouble, I'll be here for the rest of the week. I'll be more than happy to sit down and discuss this in a lot more detail. I'll tell you what, we got an hour and a half in here.
Let's take a short break. Stand up, stretch it out a little bit. And we'll move on in about five minutes here.
So let me jump in into Dynamo units real quick. So I mentioned in a previous example that units can be an issue. And the reason is because Dynamo is unit-less. But a byproduct of that is that it can do some funky things, if you will. And let me show you here.
So if you have one volt, these are basically if you extend out what voltage is. And if you can see there, that meters squared. So if you're in an imperial project, you got meters squared, but then over here it is going to pull it out with feet squared, and kilogram feet squared second-- So basically it has this multiplier of 10.76. CFM, it pulls out cubic feet per second, because it's basically looking at the base units, if you will. Or the common units inside of Revit.
So when you have more complex units like we do on the MEP side, you're going to get some funky stuff in Dynamo. So that's why earlier when we ended up with those air flow values, we had like 10.7 or whatever it is. And basically we have a multiplier of 60 that we need to use. And so if in the previous example, we didn't need to do any conversion. And the reason was it was because we extracted a value, and we use that same one to set another value.
Where it becomes an issue is if you need to perform some type of a function based on the actual number, which we'll get into here in a minute, then you're going to need to do a conversion. Or if you export to Excel, and you want to send it to somebody who's-- they're not familiar with Revit or Dynamo. And you say hey, modify those values in Excel. And they have airflows of like, 10, 15.
They're going to be like dude, what are you doing? You're messing up our project. So basically, create another sheet, copy those values over, do some conversions inside Excel so that the correct information displays there.
So let's jump in to exercise 4. And what we're going to look at here-- and I'll explain this as we're opening them up-- so sorry. I didn't close this down yet. So let me close down these. What we're going to look at is setting the breaker size or the rating parameter for a circuit based on the load.
So exercise 4 underscore start. And this should pull up a schedule. So typically when you create circuits, the rating values are the same.
You specify that in the electrical settings dialog. And that's when you create a circuit. That's what you get. And what I'm going to show you-- and this is kind of a simplified method. I know it's a little more in depth. But you can create more in depth calculations and Dynamo-- but we're going to look at creating a graph that will set that rating parameter based on the load. So exercise 4 underscore start dot dyn. And I did get you a little bit of a head start here. So if you run that, you have all your electrical circuits selected.
And the next thing we want to do is we want to first off, we want to filter out the circuits to only get 120 volt circuits. Because in this case, I have, as you can see over here in Revit, I have some that are 277 and some that are 120. So because the sizes are different, all I want to do is work with the 120 right now. So what I want to do is this-- if you still have this expanded-- in the node library, Revit, Elements, Element, and get parameter value by name. And we're going to connect up our circuits to the element.
And our parameter, we're going to get voltage. Once again, it's case sensitive, and it's got to match exactly. Connect that up, run it. And I have the voltage.
So now you can see kind of what I was talking about a minute ago. We have 120 and 277 volt circuits, but here in Dynamo I have 1,291 and 2,981. So if I filter out by 120, I'm not going to get what I need. So what I need to do is perform a little conversion here. So I can do that in a code block.
So let's input a parameter. So you can call it whatever you want. I try to just keep things consistent as far as like what I'm pulling from. So in this case, I'm going to put voltage divided by 10.76.
You can add more values if you wanted to, but voltage divided by 10.76-- or I'm sorry. I messed that up. Voltage equals, and then I'm going to put a V.
So if you put voltage and then an equal sign, this parameter is going to be your output, and another parameter, whenever you put there, that is going to be your input. And in all actuality, you don't necessarily have to have this first part. You can just put equals V divided by 10.76.
So now when I connect up my circuits here to this V in put and I run it, let's take a look at what we got. So now we have something that more closely matches what we have in Revit. It's not exact, but that's OK. Because I'll show you in a minute, I don't need exact values right now.
So now I'm going to basically perform a function in here in another code block. So we'll put voltage equals-- and then this parameter, I'm going to just use A-- and then the greater than. So I want A to be greater than 110. So basically all I want to do is filter out those 120s.
So we can use kind of a broad range. In this case, I'm going to use 110 to 125. So A must be greater than 110. And if I want to add another function in there, do and, add another A is less than 125. And then end that.
So what it's going to do is when I connect up these voltage values, it's basically going to perform a test. Does this voltage value lie in between 110 and 125? And it's going to give me some Boolean values here. Now we can use the filter by Boolean mask node in the traditional sense. So if you search filter by, that should be the first one that pops up.
So if I use this as a mask, what do I want as my list input here? Anybody? Any thoughts? My circuits, exactly. Because I want to filter out the circuits, the 120 volt circuits.
So basically, when you look at the output here, you're going to have two list. It's the in and the out each in a nested list here. Now we can start to work with it here.
The next thing we want to do is we want to get the load. And that's what we're going to use to set the rating. So in this case, I'm going to use the true load parameter. But you could use apparent load too. It's kind of whenever you want to do.
So let me show you something here. When you select a node, for example, the element dot get parameter value by name, I can do a Control-C and then a Control-V, and I can paste it. It's still going to have these wires. But if you click the inputs, and then just click in blank space, you're going to have this node here. So let's place another code block and put in true load.
And now I want my in values-- because I want my 120 volt circuits-- and I want the true load parameter. And now let's run it. Once again, I'm going to end up with some weird values. So we need to do another conversion here.
So inside this code block, let's do load equals L divided by 10.76. So I can divide that wattage by 10.76 again, or just like I did with the voltage. And then here, I'm going to have you input a few different ranges. So basically, we need to create ranges that we're going to use to set those rating values. So if you could kind of walk along with me here.
Let's do R1 just for range 1. R1 equals-- and then I'm going to use just a C as a parameter-- is greater than 0, two ampersands signs. And then C is less than 1,500. So basically, I'm looking for circuits in a range with a load and the range from 0 to 1,500 based off of a circuit breaker sizing table, just a simple one. And then R2 equals C is greater than 1,500 and C is less than 2,000.
And I got one more, but let me just kind of zoom in just to make sure everybody can see. Last line here, R3 equals C is greater than 2,000, and C is less than 2,500. And if you want to be more precise, you can do less than or equal to, greater than or equal to. I didn't add that for this example. Everybody here so far?
So now we can connect up our load values here. And when I run it, I'm going to end up with a bunch of Boolean values. We're kind of nearing the end here.
Where am I at? I'm sorry. I'm losing my spot here.
Now I want to filter by Boolean mask again. So filter by Boolean mask. So actually what I want to do is I want to place three of these, because I have three load ranges here. And once again, these are Boolean values that I'm getting. And so these are going to go into the mask inputs.
And then I want my circuits from back over here in the filter by Boolean mask node. So I just want the end ones, because all I want is the 120 volt ones. And I'm going to put these over here into the list inputs.
So I don't know if you guys can see that. Let me move this grid out of the way if that helps. Everybody good so far?
Now the last step is we need to set the parameters. So once again, that same node, set parameter by name. So in this case, we're going to do basically three groupings, because we have three different ranges here. So let's just do one at a time. So let's place a code block and enter rating.
That's going to be my parameter name. And then in that top filter by Boolean mask node I want the in input. And then the value that you set it to here is just going to be based on some type of circuit breaker sizing table.
So in this case, I'm going to use 15. And like I said, this is somewhat simplistic in terms of this is what I did in order to filter out some ranges. But you can get as more complex just as you need to.
So now, once you have these three nodes right here, you can use a crossing window, and then just press Control-C and Control-V. And then once again, make sure you disconnect that, the element end point. And then put your second filter by Boolean mask node. And then I'm going to paste another set of those there. If you wanted to, you could just connect it up and it will remove that one that was input.
You can only have one connector going into an input port, but you can have multiple connectors coming out of an output port. Oh, I'm sorry. Last thing we need to do is we need to change these other values here. So in this case, I'm going to have 20 for that second range.
And what do I have? 30 in the last one. And when I run it, it should set everything. Yes. So when I go over here, you can see based on 120 volt circuits, if they fell within that certain range, it set the rating accordingly.
I'll leave this up here if you're having trouble seeing it. So does that makes sense, kind of what we did? So we selected circuits, we got a parameter value, and then we filter them out based on a certain condition. In this case, we did two sets of that. We filtered it out by the voltage.
So we only got 120 volt circuits. And then we created some ranges as far as to what value we wanted to use to set the parameter. Everybody good? Makes sense? If you're having trouble, raise your hand please.
AUDIENCE: I'm way behind.
JASON BOEHNING: Way behind, OK. Once again, the handout is online. I want to make sure you guys get the data sets for this, because some of this is difficult to understand, especially if you're seeing it for the first time. And so I definitely encourage you to work through these at home. They are simple exercises, but these same graphs can be used on complex models too.
Any questions before we move on? No questions? Going to stay where we are just to see the screen? I'm going to give people just one more minute to wrap up and then we'll move on to the next example.
So while we're waiting, I laminated a few of my graphs that I'm using. If somebody would like these afterwards, come up. I'll hand these up. I just got two though.
Let's go ahead move on. We have 15 minutes left. And I think we can do this last one. I'm going to move a little quickly. If you just want to follow along, I understand.
So that we are on exercise 5, in Revit, exercise 5 underscore start. So in this case here's kind of what I'm going to do. Let me explain this real quick.
In example 3, what we did is we set the flow value for air terminals. Now what we're going to do is we're going to set the family and type based on those flow values so that we can get the correct next size for these air terminals. Now I would actually recommend coding that parameter into the family, but I do want to show this because it's not just for air terminals.
You can use this for several other applications. So I do want to show this. And it's very similar to the exercise that we just went through too.
Exercise 5 underscore start dot dyn. We selected the air terminals. Next, we need to get the flow value. So once again, get parameter value by name. Let me move this out of the way so you can see a little better here.
Select the air terminals, element dot get parameter value by name. And I want to get the flow parameter. It's already set. We already did that.
Now we need to perform a conversion. Because let me run it here and you can see. We have all these really small values here. 8.3, 3.8, we need to multiply those by 60.
So in this case, like I said, I can put flow equals F multiplied by 60. Or if you want, just type F asterisk 60 and you'll still get that F input. And if it helps you to keep track, you can put flow equals, if you just want to keep track of your parameters as you're going through. It really is either way.
So now when I run that, now we have air flow values. That makes sense. Now we need some more conditional statements to perform a function here. Let me get my bigger paper so I can see what to enter. And so these are just going to be based off of some air terminal next sizing table.
So I'm going to do R1 equals A is greater than or equal to-- in this case, I'm going to use greater than or equal to 0-- two ampersands so I can add another conditional statement in the same command. So A is less than or equal to 100, press Enter. Then actually if you want, you can copy this. I don't know if this would be easier or more difficult, but then just R2-- So my second range is going to be between 101 and 225.
Range 3 A is going to be greater than or equal to 226. And A's going to be less than or equal to 420. And you can add as many conditional statements here as you want. The good news is that you just have to create it one time, and then you can use it as many times as you want after that. And actually, once I send this to you, you can use these that I've already created to and just modify it a little bit to meet your standards.
Oops. I messed up here. And I added R4. R1, R2, R3, R4, R5. A is greater than or equal to 661.
And A is less than or equal to 1,000. So it's important that you pay very close attention to what you're entering here. Because as your scripts get more and more advanced, and you got to go back and start to debug some of this, it's important to get it right the first time.
Now the final step, now that we have all these ranges and we're going to get Boolean values, we just need to set parameters for the elements that meet those ranges. So I'm going to use the set parameter by name node. And I'm actually going to have a lot of these. So let me move it up here. And the parameter name is going to be family and type.
So make sure you have capitalized the F and the T. And have spaces family and type. Now to specify the value, I'm going to use a family types node. So back in the node library, if you remember under Selection, you can select by family type. So Revit, Selection, Family Types, place that node. And then we can find our supply air.
What is it? It's supply diffuser. And so I have 12 by 12, and then 24 by 24. So let's start out with 24 by 24 6-inch neck. And connect that up to the value.
And let me move these over here just a little bit. Everybody with me so far? So element dot set parameter by name. The parameter name is family and type. And then in the family types node, select the supply diffuser with a 24 by 24 with a 6-inch neck.
After that, we need to create four copies. Want to do a Control-C. And then before I connect these up, I'm going to do all my pasting. so that I end up with a total of five.
Next, in the second one there, you're going to select the 8-inch neck. In the third one we're going to select the 10-inch neck. So once again, 24 by 24 face, 6-inch, 8-inch, 10-inch. Then we're going to do 12-inch.
Or sorry. Did I miss that? Just basically going in order here down the list. 12-inch neck, and then last one we'll use the 14-inch neck.
So once again, it's a lot of nodes but it's just the same ones over and over. And sorry. I know this is getting really difficult to see. So now I can begin to connect these up to the element inputs.
No, I'm sorry. I'm sorry. I missed a step. My fault. Sorry.
These are Boolean values. So we need to use that filter by Boolean mask node. I apologize. Getting ahead of myself. So we need to filter by Boolean mask.
And I need five of these. Now, in the all elements of category node, that's where I have my air terminals. That's going to be my list input for every single one. We're almost done here. And then the mask is our Boolean values here.
And then-- I know this is a lot-- now I can do the in, connect it to each element here, element input. Now when I run it, and I go back to Revit. So we see 500 CFM, I have a 12-inch neck. Over here, 250 CFM, I have a 10-inch neck, so on and so forth. So I'm setting the family and type based on the flow through that air terminal.
Very similar to what we did before. Thank you. Thank you, John. Thank you. [APPLAUSE]
Once again, I know this was a lot. It's all in the paper. Let me end here. I have a quick story. So Texas Monthly magazine in Texas, they came up with a list of the top 50 barbecue joints in the state of Texas.
So my family and I, we live in Houston. Our parents, my wife and I's parents live way up here, where we grew up in Amarillo. When we go visit them we have to cross over the state. So we're going from here to here.
So I told my wife, I'm like, hey, we're going to pass by a lot of these barbecue joints. We should start checking them out. And so she obliged and was gracious enough to do that. And so we visited a lot of these barbecue places. Here's my point, as we tried out the best barbecue in the state of Texas, it was awesome.
But each place was so different and so unique, that whether the way they smoke the meat, the type of wood that they use, the way their barbecue sauce, whatever it may be, there was different ways of going about it, and they created awesome barbecue that they're one of the best in the world. Here's my point. I showed you guys a lot of methods. You guys can be great Dynamo users by doing it your own way. Figure out what works for you.
Figure out how it works in your mind, whether it's lacing, whether it's list at level where it's a combination of those, whether it's list dot map. Figure out what works for you. Keep churning in some of these examples that I gave you and it's going to start to click. And you're going to start to be able to use it for yourself in a way that makes sense to you. And then you guys are going to be back up here next year teaching all these awesome Dynamo classes on all the things that you guys have done.
So I hope you guys can take something away from this. I had a great time. My point is, figure out what works for you. If you have any questions, contact me. I'd love to chat with you more about this. Hope you have a great rest of your AU. Thank you. [APPLAUSE]