To perform certain common 3D modeling commands such as Move (or Translate), Rotate, and Mirror, Dynamo requires Vectors and Planes as inputs. After explaining what Vectors and Planes are, this video will cover how they tend to be used in Dynamo workflows, how to how to construct them and visualize them in the Geometry Preview, and how to apply them to Dynamo's Translate, Rotate, and Mirror nodes.
- [Voiceover] To perform certain common 3D Modeling commands such as Move, Rotate and Mirror, Dynamo requires Geometry data types called Vectors and Planes as inputs. First we'll cover what Vectors and Planes are and how they're constructed, then we'll apply them to Dynamo's Translate, Rotate and Mirror nodes. We begin with two Polygons, a Square and a Triangle. We also have a List Create node that contains these two Polygons in a list. Now you're probably already used to using a Move command in AutoCAD or Revit.
In Dynamo, the node that performs the Move function is called Translate. We can find the Translate node in the Geometry library under the Geometry category. I'm going to go ahead and select the Translate node that takes a Direction as an input. We'll use this Translate node to change the location of both of these Polygons. This node takes two inputs, Geometry which is the easy part. We can go ahead and plug our Geometry list in now. And it also takes a Direction.
Hovering over the Direction input tells us that Dynamo is looking for a Vector which is a data type that we haven't really talked about much in detail. Vectors are most frequently used to specify a Direction. Think of them as pointers. A lot of times but not always they'll tell Geometry where to go. Vectors have their own category within the Geometry library. Let's create a brand new Vector by coordinates to see what it does. You can see that similarly to the Points By Coordinates node, it takes an X, a Y and a Z input.
But remember we aren't specifying a location like a point. We're determining a direction which might be easier to understand after we see this Vector in action. Let's see what happens when we assign values to these inputs. Going to drop in three number inputs and let's assign the values say three, five and 20. So nothing happens in our Geometry preview, but checking our node preview, we're told that that we have in fact to Find a Vector. Dynamo doesn't have a Geometry preview for Vectors.
I prefer to visualize Vectors by using a node called Line by Start Point Direction Length, which we can find under the Geometry Lines section of the node library, but it's faster to search for it. This node will draw a line based on an Origin point and a Direction which is the Vector we just set. Let's plug our Vector into Direction. To keep things simple, let's use Dynamo's origin as the start point. There is a shortcut node for the Origin. Let's type Origin into our node library search.
The last input here is a Length. Now if we'd like, we could assign whatever value we want, but each Vector actually has a Length. If we scroll across in our Vector node preview, you can see that the length of this particular Vector is 20.833. If we scroll down a little bit in the Vector section of the node library you can see that we're able to query a Vector's Length with this node. I'm going to plug in the Vector's Length into the Length input over new Line.
If we take a look at our background 3D preview, you can see that Dynamo has now drawn a line starting at the Origin and it points in the direction of the Vector that we've defined. Remember, the Vector isn't a line. It's simply a Direction starting in this case at the Origin and pointing towards the end of the line, which in this case is at the location 3, 5, 20. To really understand, let's plug our new Vector into the Direction input of our Translate node.
There, see what happened? The square and the triangle both have been moved to a new location based on the Direction that we defined with our Vector. Note that Translate doesn't erase the original Geometry, it creates a copy in a new location. If we needed to hide the original Geometry, we could turn off the Geometry preview. But the information is still there in the original node in case we need it again downstream. Let's go ahead and create a group of these nodes, because they're all working together to Translate Geometry. Now let's take a look at another common command, Rotate.
Let's head over again to the Geometry, Geometry section of the node library to drop in a Rotate node. Let's use the one that takes an Origin axis in degrees. Again the Geometry input here is easy. Let's plug in the Geometry list that we just translated. The remaining three inputs are the same as we used in another video to draw an Arc. Origin is going to be the center point of the rotation, or the point that we'll rotate our Geometry about.
Let's again use Dynamo's Origin node for this one, which means that we're going to rotate both our square and our triangle around the Dynamo Origin. Next we're asked for an axis which if we hover over the input is a Vector data type. As we say in the Translate example, we could construct our own Vector specifying X, Y and Z Components. Dynamo also includes in the node libary a few shortcuts for commonly used Vectors named after the X, the Y and the Z axis. Let's do a quick library search to drop in a Z and an X axis and we'll see how each one performs differently.
Lastly, we need to provide a number for how many degrees of rotation we'd like to see. Let's drop in a Number Slider here. We'll want to set the top of the range to 360 degrees which is one full rotation. And negative 360 would be the bottom of the range, which is one full rotation in the opposite direction. Let's go ahead and plug this into our degrees input. Looks like our rotation is working. Now let's quickly replace this Z axis input with the X axis to get a sense of how it affects our rotation.
See, now the Geometry rotates around the red X axis instead of the blue Z axis. Let's plug our Z axis back in and we'll delete the X axis. Now let's think for a minute about what's happening. We're rotating a list of two items about one single Origin. Let's change our Origin input from one single point to a list of two points. We can use a Polygon query node called Center to extract the center point of each of our two Polygons. We can find this node in the Geometry Polygon section of the node library.
Let's plug our two Polygons into the Center node to extract their center points, and then we'll plug those center points into the Rotate node to see what's changed. I'm going to go ahead and delete our Origin point because we're not using it anymore. We'll move our Polygon Center node into its place. Let's turn off the background preview for these rotations. Before we move on though, let's select these nodes and create a group since all of these nodes are working together to produce a rotation. The last operation that we'll cover in this video is the Mirror function, which you're also probably familiar with Revit or AutoCAD or some other CAD software.
Just like Rotate and Translate, we can find the Mirror node in the Geometry, Geometry section of the node library. Here we can see that the node takes two inputs, Geometry which again will be our list of translated Geometry, and a Mirror Plane which if we hover over the input preview says that it needs to be of the Plane data type. The Plane is another Geometry data type that we're seeing for the first time in this video. A Plane is like a flat surface that extends infinitely in all directions. We'll see it represented by a square in Dynamo's Geometry preview.
Let's navigate to the Plane section of the node library. There are plenty of options here to define a Plane. In our case, let's use the ByOriginNormal. The inputs here are in Origin, so let's again reuse the Origin node from before. And a Normal, which is again a Vector type. Let's use the Vector that we constructed at the beginning of this example and we'll plug it into the Normal input of our new Plane. We can see that a small square has appeared at the Origin in our background 3D preview.
And it appears to be slightly angled. If we take a look at how it seems to be oriented in relation to the Vector we visualized, we can see that the Plane forms a 90 degree angle with the Vector from all sides. This is the definition of a Normal. It's a Direction that perpendicular in all three dimensions to a point on a surface or a Plane. In another video, we'll take a look at how to extract the Normals from a series of locations on a surface, which can be really helpful in constructing complex panelized structures or analyzing whether a surface is Plane or if it's Bent.
For this example though, we used a Vector to define the Mirror Planes orientation. So now that we have our Plane, let's go ahead and plug it into the Mirror Component. So there we have it. The Polygons are mirrored across the Plane that we just defined. Now that we've finished up our Mirror function, let's group these three nodes together as well. As a shortcut, you can press ctrl g on your keyboard and it'll add all those nodes to a group. So we've now performed a few of the most common modify commands. We ran a Translate, Rotate and a Mirror.
And in doing so, we've discovered how to use two new data types. A Vector and a Plane.
- 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