When attempting a problem in Dynamo, it can be effective to start with the final desired result and work your way backward through creation of the graph. Here, see how to start with placing a single family element at a specified point location.
- [Instructor] So if you watched the previous video, you'd know that our goal is ultimately to create a series of trees along some curved paths. Now I'm not going to start with that, I'm actually going to start with an empty file here. This one was just based on the out-of-the-box architectural template, so there's no geometry in here yet. But I wanted to start with the most basic piece of that graph, and that is placing a single Revit family. Now this isn't necessarily the most efficient way to place a Revit family, you can do it much easier just in the interface of Revit, but if we go through the process of building a Dynamo graph to help us place a Revit family, that's sort of a foundational skill that we'll build upon to ultimately get to the final graph, which we'll place several of those families along the curved paths.
So we're going to need to launch Dynamo to get started here, and I do want to point out that if you're new to Dynamo, that it's really important that you first start in Revit. Create a file or open a file like I've done here, and then launch Dynamo. You can launch Dynamo from either a project file or a family file, it doesn't matter which one, but you want to have a document open in Revit first, then you launch Dynamo, and Dynamo will tether itself to that document. So I'm going to go to the Manage tab, and I'll click Dynamo, and it will launch in a separate window.
Now it can be a little challenging if you're working on a single monitor, because Dynamo's in front of Revit and sometimes a little tough to see what's going on in Revit in the background, and there's a few techniques we can use to kind of manage our screen, but for now I'm going to leave Dynamo where it is, and I'm just going to kind of click here in Revit in the background, and kind of pan my mouse over a little bit so that I can see kind of where the center of the screen is, because initially when we place this first family, it's going to show up right about there in kind of the center of the screen. Kind of eyeball where the point is between these elevation markers.
So then back over here in Dynamo, I'll click the New icon to create a new graph, and we'll go ahead and start laying this out. So if you're brand new to Dynamo, Dynamo uses nodes and wires. You can find all the nodes here in the Library, and then you connect them together using wires. It's a fairly straightforward process. So I'm going to start with what I want to end up with. Ultimately what I want to end up with is a Revit family element, specifically a tree, but a Revit family element placed in my Revit model. Now that'll be our sole goal for this video, but of course, by the end of the chapter, we're going to have several of those Revit family elements, but it'll still be the same basic foundation.
So I'm going to expand the Revit branch of the browser here, and then I'm going to scroll down and look for Elements with an S, and then scroll down further and then Family Instance. Now here under Family Instance in this plus category there are several ways that you can place family instances in your model. I'm going to choose this one which is a fairly simple and straightforward method, By Point. So that will create our first node here, which is FamilyInstance.ByPoint. If you hover over it, it gives you a little bit of information at the top, and kind of tells you what this does, and the goal here is, as I said, this is where I want to end up.
Right, I want to have a family instance by point, but if you start here, you can then hover your mouse over the inputs that are on the left-hand side of the node, and that will give you some clues as to what you need to provide this node in order to satisfy it. So it needs a family type, and it needs a point. So in other words, what family do we want to place and where do we want to put it? Okay, so as far was what family we want to place, I'll scroll back up here, under Revit, under Selection, and then there's a Family Types node, and I'll just sort of position this next to it and feed that in with a wire.
So you just click the output port and the input port and that connects it with a wire. And then I need a point, a location to place this thing. So that's going to be under Geometry. Scroll down, Point, and then there's several ways you can create points, just like there was several ways we could create families. Now I'm going to pan this over slightly just holding the wheel down on my mouse and dragging a little bit just to give myself some room right here, and then I'll do a simple way to create a point, a point by coordinates x and y.
And then that creates this point node. Now when you do that, you should notice something immediately appear in both the 3D view in Dynamo and in the Revit workspace in the background. So you get a little blue dot in Revit, and then you've got a black dot here in the Dynamo workspace. So you can either use your wheel to zoom and pan the graph itself, or if you toggle this little switch up here at the top, you can actually use that zoom and pan to adjust the 3D view. If you hold down your right mouse button and drag, that'll orbit.
And so you can see very clearly here that we've already got a point. Now that's different than the family instance, which required us to feed in inputs before it would give us anything, so sometimes a node has default values, and sometimes it doesn't. So let's hover over each of the inputs of the Point.ByCoordinates and see what it says. So it says two bits of information here. It needs a double, that's the kind of information it wants, and the default value is zero. Now double, by the way, is just computer programmer speak for a number with decimal points.
Okay, so a double byte precision number is what that means, so it's computer science term for a decimal value number. So both of these default to zero. If you scroll up here and locate the Core and then Input branch, you can create a number. And what I'll do is just pan over slightly here, feed that in... Now of course it's still set to zero, so there's no change, but if I change this value to something else, like maybe five, you're going to see it jump over five squares here in the grid in the background in Dynamo, and you should see it move a little bit there in Revit.
Now if you didn't quite see it in Revit, choose a bigger number. There's 20. Okay, now I'll go back to five. Now I can create another number node and feed that one into the y value, or, if you want to, use the same number in multiple inputs, it's actually possible to take multiple wires out of a single output and feed those into other inputs, but notice that that replaces the wire in the input. So another way to say that is you can have as many wires as you want coming out, but you can only have one wire coming in.
So if I take this and I feed it back in, it will replace the existing wire that's there. So now I can put in different values there for both the x and the y. So that gives me my point, that's my location, and now if I feed that into the point input here, we should get something in Revit. Except that we threw the node into a warning state. Now if I hover over this little message here, it says the value cannot be null. So what happened is that this input right here is currently null, which is a computer programming term for nothing.
It's an empty value. And that's because we haven't chosen a family yet from this drop-down. So if you open that drop-down list, it's populated with all of the family instances that are currently in your Revit file. Now we're in a Revit project file based on the default template, so this is the list of families that are in the default template. If you start with your company template, it'll be that list. If you start with a family, it'll be a shorter list, but whatever file you're in, that's where this information comes from. Now we said we wanted a tree, so I'm going to scroll down here, and under RPC Tree, it doesn't matter which one you choose, but I'm going to pick any tree, and you notice I'm going to get something immediately there in Revit.
Let me just move this node over here because it got a little too long, and that really gives us the final result. Now the last point I want to make here is there's a difference between Dynamo geometry and Revit geometry. And that should be fairly evident by looking at the screen, because in Dynamo, all you see is a dot, but in Revit we actually see a tree. So often you're going to get things that appear in Dynamo that are kind of only visible in Dynamo until you turn them into something Revit, or vice versa.
You might start with something in Revit, and you bring that into Dynamo, and then you have to convert that into something Dynamo understands. So at first it can be a little weird thinking of it that way, but Dynamo is its own thing, so there are separate kinds of geometry and separate kinds of things that are available in Dynamo, and then they get kind of converted, if you want to think of it that way, into Revit. Now if you really want to see the tree here in Dynamo, you can go to the Revit branch under Element.
Elements, rather, with an S, and then under Elements with an S, you look for Element, singular, and then finally, Geometry. And this node will create Dynamo geometry from the Revit element. So if I feed the Revit element, the family instance into here, it will create that tree in the Dynamo workspace. Now only do this if you really need to see it, because this can be computationally expensive, slow things down, in other words, so if I had hundreds of trees and I did Element.Geometry, I'm going to wait a while for it to generate all that geometry in Dynamo.
So if you don't really need to see the geometry in Dynamo and you're fine with the points, then you can just unwire this, and it will work just fine. But this can be a nice visual if you want to see that in your Dynamo workspace, so that's the Element.Geometry, and that will kind of bridge the gap between the two. So that's the first step in our graph. We now have a single tree element, so in the next several videos, we'll learn how to actually start placing multiple trees instead of just a single tree along those curved paths.
- Placing a single Revit Family
- Selecting elements with basic selection nodes
- Lists and lacing
- Renaming multiple project views
- Adaptive component requirements
- Selecting elements by family type
- Joining multiple lists into a single list
- Removing the unwanted points
- Reorganizing points