This video covers the basics of constructing surface geometry from a list of boundary curves and by extrusion, and solid 3D geometry by extrusion and loft. For each example, we will first create a single surface or solid element, then identify how data needs to be structured to create multiple elements. Nodes used: Surface.ByPatch, Curve.Extrude, Curve.ExtrudeAsSolid, Solid.ByLoft.
- Now we're ready to take some of the curves in our Dynamo graph and use them to create surfaces and solids. Let's begin by opening the SurfacesAndSolids exercise file, which contains three groups of nodes from previous videos. The first group of nodes contains a list of polygons, which is a square and a triangle. The top-right group of nodes creates a vector that we use to translate or move those polygons. And finally, the bottom-right group of nodes was used to rotate each of those polygons around their center points.
For the moment, I'm going to hide the previews on the geometry coming out of the Translate and the Rotate nodes. Let's begin with one of the simplest methods of creating a surface, a surface ByPatch, which we'll in the Geometry-Surface section of the node library. This node will take a closed curve as an input, and it'll generate a surface using that curve as its boundary edges. We can see that the single input of the Surface.ByPatch node is asking for a curve.
As I mentioned in a previous video, the Dynamo curve data type can include polygons, which is what we have here on our graph as well as other things like polycurves, nurbs curves, and a few others. Let's try plugging in just the square polygon into the closed.Curve input. As you can see in our geometry preview, that was a really easy way to create a surface. Now let's try plugging in the list of both of our polygons to see if it'll create two surfaces. And it does in fact create two surfaces when we provide two polygons as the input.
Let's go ahead an hide this geometry preview. Now let's look at what might be the most common way to construct 3D geometry, the Extrude function. Extrusions usually take a curve or a set of curves, and they pull them in a direction to produce a 3D form. Since extrusions just about always take curves as their inputs, let's navigate to the Geometry-Curve section of the node library to look at our extrusion node options. We see a few options of both the Extrude and the ExtrudeAsSolid nodes.
SInce we already have a vector defined on our workspace, let's place one of each of the extrusion nodes that require a direction input. And we'll compare the outputs. They both take the same inputs, a curve and a direction. Let's plug our list of polygons into the Curve.Extrude node. Well, notice that our background 3D preview updated. Reason being, if we hover over our direction input preview, there is a default value, which is basically a Z-value of one unit.
Let's go ahead and plug the vector that's already on our workspace into the direction input. The result is a 3D form. Both the rectangle and the triangle are extruded into a series of surfaces in the direction of the vector. If we rotate our geometry preview to a top view, you'll notice that these are open surfaces, meaning there's an opening at the top and the bottom. Also note that in the node preview, each set of surfaces is described as one surface rather than a list of multiple surfaces.
If we needed to extract a single face, we could. We'll cover that and other ways of analyzing surfaces and solids in another video. Now let's hide the geometry preview and plug the same inputs into the Curve.ExtrudeAsSolid node. Here we see two things that are different about the way that this extrusion happened. First of all in our node preview, we're seeing that these are two solid objects instead of surfaces. We're also seeing in our geometry preview the top and bottom of both extrusions are capped or closed.
So congratulations, you just built your first solids in Dynamo. Let's group these two nodes together since they both perform the function of creating an extrusion. I'm also going to go ahead and hide the geometry preview to make room for our last example. The last method we'll look at to construct Solids is one of my personal favorites. It's the loft, which if you're a Revit user, you might know as a blend. Unlike an extrusion, which takes a single curve object and pulls it straight in a single direction, a loft takes two or more input curves and draws 3D geometry to connect them all together.
Now is a good time to turn on the geometry preview for our Translated and Rotated polygons. For our last example, let's try to create a solid that connects our bottom and our top square polygons and our bottom and our top triangle polygons using the Loft tool. Let's navigate to the Geometry-Solids section of the node library to see what our options are for lofting geometry. Let's use the version of the loft node that only requires crossSections as an input.
We can tell by hovering over the input preview that Dynamo wants a list of curves. We can tell that it wants a list because it says, "curve" followed by square brackets. Square brackets should remind you of how Dynamo displays the index of items in a list. Dynamo uses the square brackets here as a hint that it wants a list plugged into this input. Let's drop in a List.Create node so that we can assemble our list of curves. Let's begin by only trying to loft the bottom and the top square polygons together. Once we get that right, we'll try to loft both the squares and both of the triangles together with the same node.
In our List.Create node, let's first plug in the original square polygon, and for the second item, we'll plug in the Translated and Rotated copy. We can find the bottom square at the beginning of our example. We'll plug that into item0. Right now, the only place in our workspace that we have the top square is together in a list with the triangle. Let's try to extract just the first item. We can do this using the List.FirstItem node. Here you can see we have isolated only the top square polygon. We'll plug that into item1 of List.Create.
Our list now should consist of the bottom and the top square. Let's plug that polygon list into our Solid.ByLoft node. And there we go; we've lofted our solid. Now let's try to loft both the square and the rectangle together using the same Solid.ByLoft node. First, let's think about how we might need to structure our data. When we created the first loft, the input was a single list, which consisted of two polygon crossSection curves. In the same way, to build two lofts would require two lists, each containing two input curves.
We only have one crossSection as an input though, which means we have two options here. One option is we continue the same process that we just did. We copy/paste this cluster of nodes, but feed it different set of curves to produce each loft. In this case, we're only working with two solids, so that's a feasible method. But what if instead of trying to loft two solids, we needed to produce a hundred solids? We'd be copy/pasting the same set of nodes over and over and over again. And in visual programming, that's a red flag. Anytime you find yourself copying the same cluster of nodes, it's an indication that there's a more efficient way to accomplish what you're trying to do, which brings us to our other option.
If we want to create two solids with one node, we can structure our data as a nested list, two lists each containing the two cross-section curves that we need to produce the loft. So let's think about the best way to construct two lists. One containing the bottom and the top square and one containing the bottom and the top triangle. We know that we began this example with a node whose output was the list of the bottom square and the bottom triangle. I'm going to disconnect our Solid.ByLoft node so we can easily preview our polygon geometry.
We know that we started off this example with a list containing the bottom square and the bottom triangle. We also know that we have a list that contains the top square and the top triangle. Let's begin by putting those two lists into a List.Create node to create a nested list. I'll drop in a new List.Create node. And we'll plug in our base geometry into item0 and our top geometry into item1.
Now you can see we have two lists, each containing two polygons. Let's see how we do when we plug the output into the crossSections input. No, it looks like we have an error. The reason here is that Dynamo is trying to create a loft from the curves within the same list. What I mean by that is, in our first list, Dynamo is trying to loft the bottom square to the bottom triangle in the same way that it's trying to loft the top square to the top triangle.
What we really need to do is rearrange our data. We're interested in lofting the first polygon in each list together, as well as the second polygon in each list together. Fortunately, we've used an extremely useful list-management node in another video that's about to save the day here, the Transpose node. Transpose will reorganize our data so that the two first items will be in a list together and the two second items will be in a list together. Let's give this node a try. And there we go. Two lofted solids, thanks to the List.Transpose node.
Again, imagine if instead of starting with two curves in this example, we started with a hundred curves that we needed to loft. With just a little bit of list management, we could create a hundred solids just as easy as we've created two. So now you know a few of the common techniques for constructing surfaces and solids from curves, particularly the Surface.ByPatch, surfaces by extrusion, solids by extrusion, and the Solid.ByLoft.
Updated
9/26/2017Released
3/29/2016- 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
Share this video
Embed this video
Video: Constructing surfaces and solids