Getting Started with Dynamo for Civil 3D: A Beginner’s Guide

Autodesk University
Autodesk University
7 min readOct 10, 2020

By Samir Rezk for Autodesk University

Do you love the dynamic relationships of Civil 3D object data, but still find yourself zoning out after a few minutes of doing a repetitive task? Using basic but logical math computations, we can visually arrange functions or nodes, and use Dynamo to automate many tasks that are required as part of any infrastructure project. A Dynamo script can be the missing dynamic link between AutoCAD objects and Civil 3D objects and, should the alignment change, AutoCAD blocks placed along the alignment can be automatically updated. In this article, we’ll explore why Dynamo has gained popularity among Revit users, and how to benefit from it in our Civil 3D workflows. We’ll explore the Dynamo interface, and the fundamental concepts to getting started creating your first logical graph to execute geometry driven by data.

What Is Dynamo?

Historically, it is relatively easy to repeat an AutoCAD operation with a script or macro. Likewise, we can create a new function with Lisp. However, the limitation of both is that the information is not dynamic. In addition, AutoCAD scripts do not work well with Civil 3D data, and Lisp requires learning the programming language to code new functions. Dynamo bridges the gap to create dynamic repeatable operations between AutoCAD and Civil 3D.

Dynamo is programming! It is user friendly visual programming, so Civil 3D users do not need to learn or write code. It is already written for us; we simply need to arrange the code. In other words, one needs to think with the logic of a programmer but learning a programming language is not required. Dynamo’s open-source graphical programming interface enables BIM modeling with the data and logic environment of a graphical algorithm editor. Users can build custom workflows for creating, positioning, and visualizing data; testing variations faster; iterating more frequently; and creating better designs in less time.

Install + Launch

Dynamo for Civil 3D is an extension available to Civil 3D 2020 only. Install it separately from your Autodesk Desktop App or your online Autodesk Account (product update section).

To launch within Civil 3D:

  • Manage tab
  • Visual Programming panel

The Workflow

The Library pane contains the Libraries, including:

  • Core libraries such as Geometry
  • Program-related libraries such as AutoCAD

Library contains Categories:

  • The Geometry Library contains a Curve category, Points category, etc.

Category contains Nodes:

  • Most Nodes are the functions that compute or calculate something, such as:
  • Point.ByCoordinates (input numbers — output a point)

The Library

Dynamo has an active user community and developer base. Many developers create additional libraries that can be installed as a package. A package is simply a container of nodes that perform additional functions from within Dynamo. You can browse for packages in two ways:

Nodes and Wires

  • A Dynamo graph consists of Nodes connected with Wires. Nodes are prebuilt programming code that perform a function or operation. Wires identify the data flow from one operation to another.
  • Dynamo uses Autodesk Design Script as a programming language in which the nodes are written.
  • You may embed Iron Python code to perform more advanced operations.
  • Computation flows left to right.
  • There are three major Node behaviors:

1. Create: Create data/geometry

2. Modify: Compute data

3. Query: Get information

Common Data Types

Computational Nodes are typically looking for a specific data type to perform the operation on.

As an example, the Point.ByCoordinates Node is looking for a Double Number type input for the X and Y ports for it to compute the Point geometry type.

Types

String

  • Programming term for Text

Number

  • Double (decimal number), or
  • Integer (whole number)

Boolean

  • True or False switch

Geometry

  • Many types of Dynamo Geometry are available: abstract, curves, meshes, modifiers, points, solids, surfaces, and tessellations
  • Note: a Line is simply considered a straight curve

Code Block

There is a special type of Node that lets you type Design Script code directly. Considering that all nodes are written in Design script, any Node can then be written in Design script or converted to code. Code blocks are useful in creating advanced multistep long operations or simple one-line items. You might opt to use a code block to make the graph concise and more manageable. Another benefit is that a simple double click in the canvas will insert a code block node.

Below are a few time-saving Nodes:

Number

String

ListCreate

Sequence — Creates a list of numbers at a specified beginning, amount, and a step. The Amount is synonymous to the AutoCAD Divide command specifying the number of segments.

Range — Creates a list of numbers at a specified beginning, end, and a step. The step is synonymous to the AutoCAD Measure command specifying the segment length.

Lists of Data

A list of data is fundamental to how Dynamo can repeatedly perform the same operation to the end of eternity.

In the screen capture above:

The Range node is used to generate a list of numbers, the numbers, as a List, are connected to the X port of a point creation node to repeatedly create point geometry till the end of the list.

Connecting Two or More Lists

List management becomes of extreme importance when it comes time to create a correlation between two or more lists.
Luckily, the list order is always going to match the same structure from one operation to another, as long as you did not reorganize the list differently.

Dynamo contains three type of treatments that are defined by the term List Lacing. The right-click menu on the node contains the Lacing choices.

Following with the example above:

We have two lists of Points that may define the beginning and ending of a Line Segment. However, depending on how the Line node is laced, it will produce vastly different results.

Working with AutoCAD and Civil 3D Libraries

Prerequisite: Dynamo can only communicate on the active document (the open drawing). The drawing must be open and active prior to opening the Dynamo interface.

The typical workflow would be using geometry or data from the AutoCAD environment or an Excel spreadsheet as an input in your Dynamo graph. Based on the program you create, Dynamo will compute an operation, and finally write the result back to your intended environment. This can be very efficient in creating a repeatable task that can dynamically update relative to the design element.

An added benefit is the fact that one can output any sort of custom spreadsheet, enabling data travel to many other software platforms for analysis or reporting.

Example One: Working with Cogo Points and Property Sets

Problem Statement

Automatically and dynamically update Cogo Point Station and offset label information relative to a Civil 3D alignment. The context may be needing to label Utility Poles station and offset information as well as populating additional property sets for a custom comprehensive label.

Methodology

Execute Dynamo script to:

  • Capture Cogo Point locations and Alignment from active document into the Dynamo interface
  • Get relative locations of list of Cogo Points
  • Write Information in Property Set

Step by Step

1. Get Alignment of interest from the active drawing.

2. Get the Cogo Point contained in a Point Group of Interest.

3. Get Dynamo representation of Cogo Points to execute a Dynamo Computation.

4. Compute a list of locations of the Dynamo points relative to the Alignment.

5. Output Station and Offset lists of data to AutoCAD Property Set.

View the Write Cogo Point Station with Dynamo screencast.

Want more? Download the full class handout to read on.

Samir Rezk is a member of the MicroCAD team in Boston serving as an Autodesk infrastructure applications instructor with a primary focus on AutoCAD and Civil 3D technical support and training. His background is in Civil Engineering, with experience working on highways, site development, and treatment plant design and construction projects. He is a Civil 3D superfan at heart, loves good CAD practices, and enjoys exploring new features and workflows. When he takes a break from his computer, he enjoys nature, hiking, camping, scuba diving, and traveling.

--

--

Autodesk University
Autodesk University

Learn, connect, explore. The official account for Autodesk University.