In this video, we begin with a series of points, which we will then use to create a variety of commonly used Dynamo curve objects, including Lines, Polycurves, Polygons, Arcs, and NURBS Curves. This video will cover the following nodes; Line.ByStartPointEndPoint, PolyCurve.ByPoints, Polygon.ByPoints, Arc.ByThreePoints, Arc.ByCenterPointStartPointSweepAngle, NurbsCurve.ByControlPoints, NurbsCurve.ByPoints.
- [Voiceover] In this video we'll look at how to create several different varieties of Curve Objects. Each of these Curve examples is going to require some point geometry as an input. To introduce you to our workspace, it might look like we have a lot of nodes here, but we're really just creating eight points using the points by coordinate node which is the exact node that we used in the last example to construct points. Each point by coordinates node has three number inputs that are setting the X, Y and Z coordinate values. We've also plugged every point in our workspace into a Single List Create node in case we ever need all of these points organized in a single list.
You'll notice that these points appear in our background 3D preview as well. Now we're interested in constructing Curves. So let's turn out attention to the geometry Curve section of the node library. Surprisingly, there aren't really many options here for creating new Curves. We have plenty of nodes here for performing actions on Curves, which we'll come back to in another video. But for creating Curves, not so much. The structure of the node library doesn't quite reflect this, but there are several different kinds of Curves that fall under the umbrella of the Curve data type.
Some of these include Lines, PolyCurves, Arcs, Polygons, and NURBS Curves. We'll cover these in this video beginning with the simplest which is a Line. Let's head over to the Line section of the node library. And we'll drop in a Line by start point, end point node. I should mention here that even though we tend to think of Lines and Curves as different things, a Line is straight while a Curve has bends in it, Dynamo does categorize Lines as a type of Curve. Anyway, we can see that the Line node takes two inputs, a start point and an end point. To draw our first Line, let's connect one of the point objects off to the left of our graph to the start point input.
Maybe we'll connect the second point to our endpoint. You'll notice in our background preview we now have a single Line that's drawn between those two points. Let's drop in another Line node. This time let's connect points two and three. Two is the start point, three is the end point. And again, our background preview updates. We have a second line now. Now if we wanted to, we could continue this process of copy pasting the Line node to eventually create Lines connecting all eight of these points. However, there's a much faster method that takes a little bit of list management.
We already have all eight of our points organized here in a list. And they're ordered in such a way that each point in the list should be the start point of a Line, and the next point item in the list should be its end point. So what we'd like to do is make a Line between each point in the list and its neighbor in the list. There's a useful list management node in the library called ShiftIndices, which pushes each item in a list forward by however many numbers we assign. Let's drop that node in and see how it works.
As you can see, this node takes two inputs. One is an input list which we'll plug our List Create node into, and the second is an amount which is how many spots we'd like to advance each item in our original input list. We're interested in plugging in the number one here. I'll drop in a number input. Let's set that number to one and plug it into the amount. You'll notice that if we compare these two node previews together, the point that lives at zero zero, is index zero in the first list, but after we shift the indices, the zero zero point lives at index one.
It's been shifted forward one spot. In the same way, the point that lives at zero five, now lives at index two. You'll also notice that the last item in this list, which is at 15, negative five, has been pushed to the beginning of the Shifted Index List. So let's see what happens if we plug in our original list as the start point and our Shifted Index List as the end point of a line by start point, end point node.
And as we can see in our background preview, each point is now connected to its neighbor in the list with a Line. Let's think for a second about what we just accomplished. We almost set out to solve this problem by copy pasting the same few Line nodes eight times. But instead we found a way to produce the same geometry with just these few nodes. And imagine for a moment, what if instead of eight points we needed to connect 10 or 20 or 100 points? Would it really be efficient to have the same cluster of nodes copied and pasted a 100 times? We wouldn't need to change a thing about our ShiftIndices workflow.
As long as our input list of points is up to date, this method of drawing lines between them will continue to work. In fact, I'll remove a few items of our list combine node to prove it. By clicking the Minus button and List Create, I'm removing points from the list. And you'll notice in the background preview, all of our points are still connected with Lines. I don't need to change anything else in the graph. I'm going to go ahead and undo that action with ctrl z. The lesson to be learned here is that even though you're just beginning your adventures in Dynamo, try to avoid copy pasting the same cluster of nodes over and over again, because copy pasting the same nodes over and over again is a sign that there's a more efficient and more scalable solution to your problem.
Now before we move on, I'm going to rearrange some of the nodes on the workspace to keep things a little bit tidy. There are few other methods that accomplish the same geometry as our series of Lines. One of them is called a PolyCurve. Instead of requiring us to plug in individual points as inputs like the line component did, the PolyCurve asks for a list of points which it will automatically connect together into a single PolyCurve. Let's navigate to the PolyCurve section of the node library where we'll choose to create a new PolyCurve ByPoints. Let's go ahead and plug our list of points into the points input in the PolyCurve node.
That was a really easy way to connect all of the points in our point list. This node also provides an option to connect the last point to the first to produce a Closed Curve, which we would answer with a Boolean or a True or False value. By default, this value is set to False, which is why on our background preview we don't see a Closed PolyCurve. But we could easily drop in that Boolean input node set it to True, and then we'd have a Closed PolyCurve. A very similar type of Curve geometry is the Polygon. We'll see that it appears to produce the same geometry as the PolyCurve node, but I prefer to build Polygons when given the choice.
Polygons will allow you to query information like the center point or the corner point so the Polygon later on in the workflow. Whereas getting that information out of a PolyCurve isn't always so straightforward. Let's hide the geometry preview from our PolyCurve. And we'll drop in a Polygon by Points node, which we can find under the Polygon section of our node library. You'll notice Polygon only takes one input, which is a list of points. Again, basically the same process we saw with the PolyCurves. But I like have the option of using the center point or the corner points in case later on in the workflow we need to generate that information.
I'm going to group these two nodes together. I'm going to use the keyboard shortcut ctrl g. Let's name it PolyCurve/ Polygon. I'll also turn off the preview of our Polygon. Next let's take a look at drawing Arcs, which have their own section of the node library. We see that there are lots of different methods to draw Arcs, each taking a different combination of inputs. We'll try two of these methods beginning with the Arc ByThreePoints. As its name suggests, this node takes three points as inputs.
Let's feed it some of the points on the left side of our graph. See the first, second and third points. You'll notice in our geometry preview that an Arc is drawn through each of these points. Maybe let's replace the third point with the fifth point to see how the geometry updates. You can see on our background preview, instead of ending at the third point, now the Arc sweeps all the way around to the fifth point. The second Arc drawing method we'll look at may seem a little bit more complex at first, but it's probably more familiar to the method that you use to draw Arcs in Revit or AutoCAD.
Let's drop in the Arc by center point, start point, Sweep Angle node. Going to go ahead and turn off the preview of our last Arc to make room for the Arc we're about to draw. I know that's a long name, but it's very appropriate. Look at its inputs. It'll specify a center point, a start point, and the number of degrees in its Sweep Angle. Let's plug in say the fourth point from the left side of our graph as the center point. For our start point, let's use the first point.
Let's drop in a number slider to set the Sweep Angle. We'll want to change the settings so that we can only produce numbers between zero and 360. We do see one last input though called Normal which requires a new data type we've never seen before called a Vector. Look over Vector data types in more detail in another video. But for now, think of the Vector as an axis. We need to specify a direction that the Arc will revolve around. For this Arc, we'll revolve around the Z axis trading the center point that we specified as the center of the rotation.
If we do a node library search for ZAxis we'll see that there's an input node called ZAxis, which is the Vector data type. Let's plug it into the normal input. You'll notice we now see an Arc in our geometry preview. And if we change the slider value, the Sweep Angle changes automatically. Let's go ahead and group these nodes together since they're all used to produce Arcs.
The last type of Curve we'll cover is called the NURBS Curve, which is often use to draw organic, freeform Curves. You might know these type of Curves as Splines and other CAD softwares. The NURBS Curve also has its own section of the geometry portion of the node library. Let's drop in a NURBS Curve by control points. You'll notice there are a few nodes that are all named by control points. Let's choose the one that requires a list of input points and a degree. To begin, let's go ahead and plug in our list of points as the input points.
You'll notice in the background Dynamo draws a very smooth Curve using each one of our points as a control point. Let's drop in an integer slider to experiement with the different degree values. The degree needs to be an integer between one and seven. I won't go into details about how NURBS Curves are calculated, but think of the degree as how powerful the control points are. Again, the degree needs to be between one and seven. So let's make sure our Min. is set to one and our Max is seven. Dynamo sets the default degree value as three, so maybe we'll start with that.
I kind of think as each control point as a little magnet that pulls the curve into place. The lower the degree number, the stronger the control points are and the tighter they pull the Curve. In fact, when the degree is one, the resulting Curve has no curvature and is drawn like a series of Lines. Whereas seven is a very loose Curve with the least drastic changes and direction. Again, three is the default value and is used most commonly, but you may prefer a different degree when you use it in your design.
You might have noticed that in this NURBS Curve, the resulting Curve doesn't necessarily touch each point. In fact, it only touches the start and the end point. Unless of course the degree is set to one. If it's important that the NURBS Curve you're drawing passes through each point, you'd prefer to use the NURBS Curve by points method. I'll plug in the same inputs to our new NURBS Curve node that we had previously. As you can see, this new NURBS Curve makes sure to pass through each of the points that you provide in the points list. Now before we finish up, I should mention that these NURBS Curves don't necessarily need to stay in the same plain.
Let's change one of these point Z values to see what happens. If I click to enable 3D navigation, I can use my right mouse to rotate around our NURBS Curve. You can see that lifting that point up in the Z direction is pulling the NURBS Curve off of that X Y plain and up into space. To finish, I'm going to group these nodes together. So to recap, Dynamo is capable of drawing many different kinds of Curves.
Some requiring different sets of inputs, each with its own distinct set of qualities.
- 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