Now that you know a little more about the big picture, let's jump right in and build your first Dynamo graph in Civil 3D!
This is a simple example that is meant to demonstrate basic Dynamo functionality. It is recommended to work through the steps in a new, empty Civil 3D document.
The first thing to do is open up an empty document in Civil 3D. Once you're there, navigate to the Manage tab in the Civil 3D ribbon and look for the Visual Programming panel.
Click on the Dynamo button, which will launch Dynamo in a separate window.
What's the difference between Dynamo and Dynamo Player?
Dynamo is what you use to build and run graphs. Dynamo Player is an easy way to run graphs without having to open them in Dynamo.
Once Dynamo is open, you'll see the start screen. Click on New to open up a blank workspace.
Dynamo start screen
What about the samples?
Dynamo for Civil 3D comes with a few pre-built graphs that can help spark some more ideas for how you can use Dynamo. We recommend taking a look at those at some point, as well as the Sample Workflows here in the Primer.
You should now be looking at an empty workspace. Let's see Dynamo in action! Here's our goal:
Build a Dynamo graph that will insert Text into Model Space.🎯
Pretty simple, right? But before we start, we need to cover a few fundamentals.
The core building blocks of a Dynamo graph are called nodes. A node is like a little machine - you put data into it, it does some work on that data, and it outputs a result. Dynamo for Civil 3D has a library of nodes that you can connect together with wires to form a graph that does bigger and better things than any one node can do by itself.
OK, let's build our graph. Here's a list of all the nodes that we'll need.
You can find these nodes by typing their names into the search bar in the library, or by right-clicking anywhere in the canvas and searching there.
Nodes can be placed from the library, or by right-clicking in the canvas
How do I know which nodes to use and where to find them?
Here's what your final graph should look like.
The finished graph
Let's summarize what we've done here:
- 1.We chose which Document to work in. In this case (and many cases), we want to work in the active Document in Civil 3D.
- 2.We defined the destination Block where our Text object should be created (Model Space in this case).
- 3.We used a String node to specify which layer the Text should be placed on.
- 4.We created a point using the Point.ByCoordinates node to define the position where the Text should be placed.
- 5.We defined the X and Y coordinates of the Text insertion point using two Number Slider nodes.
- 6.We used another String node to define the contents of the Text object.
- 7.And finally, we created the Text object.
Let's see the results of our shiny new graph!
Back in Civil 3D, make sure that the Model tab is selected. You should see the new Text object that Dynamo created.
If you can't see the Text, you may need to run the ZOOM -> EXTENTS command to zoom to the right spot.
Cool! Now let's make some updates to the Text.
Back in your Dynamo graph, go ahead and change a few of the input values, such as the text string, insertion point coordinates, etc. You should see the Text automatically update in Civil 3D. Also notice that if you unplug one of the input ports, the Text is removed. If you plug everything back in, the Text is created again.
The finished graph in action
Why doesn't Dynamo insert a new Text object every time the graph is run?
By default, Dynamo will "remember" the objects that it creates. If you change the node input values, the objects in Civil 3D are updated instead of creating brand new objects. You can read more about this behavior in the Object Binding section.
This example just scratches the surface of what you can do with Dynamo for Civil 3D. Keep reading to learn more!