Article
Generative Design of Landforms with Dynamo in Civil 3D

This article shows you how to create an associative parametric model to introduce fundamental concepts that underpin computational design while exploring visual programming in Dynamo software. We will enhance with parameters retrieved from AutoCAD software and Civil 3D objects. We will show how to organize and export a point cloud representing the landform and link it into Civil 3D. Then we will integrate this landform as a triangulated irregular network (TIN) model into the model of the existing environment and perform several analyses, including grading, storm water, and cut/fill balance. Based on this analysis, we will optimize the parametric model. As the model is dynamically linked, we can check the improvement immediately in Civil 3D and iterate the process conveniently. We will also show how to use Dynamo to link landforms created by designers as NURBS with TIN surfaces that engineers can use.

Introduction

Parametric, Computational, and Generative Design

The parametric design process is based on rules and parameters to define and describe design intent and design response. In a computational design process, the design is described in a programming environment with a programming language. The generative design extends this process by iterations (varying the parameters) and constraints to generate a certain number of valid outputs. The designer or a learning algorithm than fine-tune the feasible region by changing minimal and maximal values of an interval in which the parameters meet the set of constraints, to reduce or augment the number of outputs to choose from (fit survivor) and create the next generation.

Evolution of generative design.
Evolution of generative design.

Generative design is not restricted to computer or AI, albeit digital technologies are certainly a good tool for creating a large number of design options, as well as ranking the solutions where goals can be quantified.

Dynamo for Civil 3D, DesignScript, Python, and Zero Touch Nodes

Dynamo Nodes

Dynamo is an environment for visual programming that allows users without a programming background to build algorithmic processes to implement as tools and resources. Rather than by typing code, Dynamo programs are created by manipulating graphic elements called ‘nodes.’

Each node performs a specific task. Nodes have inputs and outputs. The outputs from one node are connected to the inputs on the other node using 'wires.' The program or 'graph' flows from node to node through the network of wires. The result is a graphic representation of the steps required to achieve the end design. This approach to programming is better suited for visually oriented types like architects, designers, and engineers.

Dynamo for Civil 3D extends this concept by providing nodes that access Civil 3D objects like TINS, feature lines, and corridors through the Civil 3D API (Application Programming Interface) in a more accessible manner than typical programming languages like C# or C++. It allows for the automation of repetitive tasks, access to civil objects data, generation of multiple design options, and test performance.

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

DesignScript

Visual data flow programming uses incredibly simple rules for connecting nodes together. All nodes follow this simple graph-node convention, allowing users to discover more functionality even from unfamiliar nodes. As a result, visual programming has an intuitive access quality, so users with a minimum of training are immediately productive and able to explore new functionality. However, this initial ease-of-use advantage of visual programming can also become a disadvantage as projects become more complex.

By implementing a series of intermediate programming techniques, DesignScript is a soft transition between visual data flow programming and text-based scripting. Thus DesignScript provides a gentle learning curve that allows the gradual introduction of more advanced programming concepts and notation. DesignScript connects the pragmatic world of design automation and production to the world of computer science and algorithmic thinking. With these new possibilities, users can move beyond automating existing design processes to new forms of computational design and architectural expression. From a technical perspective, DesignScript is a multi-paradigm domain-specific end-user language and modeling environment for architectural and engineering computation.

DesignScript was originally developed at the Autodesk Singapore Research and Development Centre and is now the computational engine within Dynamo. Nodes or groups of nodes with wired logic can be automatically translated to DesignScript. Civil 3D and AutoCAD elements are exposed through out-of-the-box nodes.

Python

The third way of creating programs in Dynamo is using Python, a high-level, general purpose, interpreted open-source programming language. Using Python gives the user access to a wide range of modules and packages for mathematical and data science tasks. Python can access AutoCAD and Civil 3D objects through APIs.

Zero Touch Nodes

Zero Touch nodes are custom, ready-to-use nodes written and compiled in C#. Writing custom nodes in C# improves type-safety and robustness of code and enables the development of programs that would be difficult to achieve using Python and DesignScript. As programs written in C# compiled before runtime, they execute quicker than Python, making it an ideal option for projects that demand a high degree of performance. Zero Touch Nodes provide access to Civil 3D objects currently not accessible through out-of-the-box nodes.

Landforms in Engineering, Landscape Design, and Art

Grading and terrain modeling are a key part of site engineering, landscape design, and land art. Shaping the Earth’s surface must not only develop the aesthetic potential but also requires ecological sensitivity and profound technical competency. The successful collaboration between artists, designers, and engineers depends on the integration of tools and data for the form-finding process engineering software for analytical tasks as well as tools for the generative design.

Landforms
Landforms in land art, landscape design, and engineering. Desert Breath by Danae Stratou, Alexandra Stratou, and Stella Constantinides (left); first known grading drawing for landscape design by Adolphe Alphand for Parc des Buttes Chaumont, Paris (center); geomorphic design for mining area reclamation (right).

This article will break down the process into smaller tasks and a flexible approach. In the first part, the focus is on AutoCAD's native parametric design elements (NURBS and procedural surfaces) and their integration in TIN surfaces. The second part has a focus on computational modeling techniques for the parametric form-finding process. The third part focuses on workflows to leverage the strength of each tool.

Learning Resources 

1) Connecting NURBS and Ruled Surfaces to Civil 3D TIN Surfaces

The drawing contains two paths and three staircases (built with my LX-Stair Add-On). Between these five elements are two gentle undulated landforms, one as a ruled surface and one as NURBS.

NURBS representing grading between two paths and stairs.
NURBS representing grading between two paths and stairs.

Open Dynamo from the Manage tab and start. All available nodes are in groups and subgroups in the left Library pane (selectable). With two 'Select.Object' nodes (from the AutoCAD selection node group), we can access the two surfaces (or any other drawing object). Many AutoCAD objects can be translated to Dynamo objects. But currently, this node has no implementation for NURBS or ruled surfaces. So I built a ZeroTouchNode that can directly extract points from these objects instead. The node can be installed via the package manager.

After installing the ALC-ZTN, you have the 'NURBS.GetPoints' and the 'Surface.GetPoints' node available. So let’s use the ‘Select Object node and select the NURBS surface from the Civil 3D drawing and add a ‘NURBS.GetPoints’ node. After connecting the nodes, a field of Dynamo points is created that represents the NURBS. The node calculates the points at the 'u' and 'v' parameter of the NURBS. We can increase the density of the points (and accuracy of the surface representation) by two 'Integer.slider' nodes for the 'udiv' and 'vdiv' values from the surface.

The output of this node is a structured list of Dynamo points, as we can see in the ’Watch’ node, but not in the format expected for a point list in Civil 3D CSV import. With the ‘Point.X’ ‘Point.Y’ and ‘Point.Z’ nodes we can extract the values only in three separated lists. We combine the three list in to one with a ‘List.Create’ node, displayed in a ‘Watch node’.

We need to transpose the list to get the right order and rank of list, suitable to connect to ‘Data.ExportCSV’ node. This node also needs an input for the file location, provided by a String Input node. We duplicate all nodes by copy/paste, change the file name in the copied input String and using the copied ‘Select Object’ node to select the ruled surface. Dynamo gives us a warning as the copied ‘NURBS.GetPoints’ node can’t take a ruled surface as input. We need to replace this node with a ‘Surface.GetPoints’ node and rewire accordingly. For better readability, we rearrange and group nodes. The node creates two CSV files:

  • nurbs.csv
  • surface.cvs

We are now able to use his two CSV files will as definitions for a TIN surface inside Civil 3D, so we can make use of all tools from Civil 3D to analyze the surfaces If necessary we can adjust the surfaces, run Dynamo again, and rebuild your surface.

Slope analysis for TIN from NURBS and ruled surface representing grading.
Slope analysis for TIN from NURBS and ruled surface representing grading.

2) Creating Landforms Driven Algorithmically Inside Dynamo and Adding Them as Point Groups to a Surface Definition

Creating Single Point (Peak)

The process starts with an empty metric drawing. We also set the Dynamo mode to Automatic. We develop the graph backward from output to the necessary inputs. The output to Civil 3D will be a single COGO point using the 'Point.ByCoordinates' node (from the Civil 3D nodes). The inputs for this node are document, layer, geometry, and raw description. We can get these values with the 'Document.Current' node and 'Document.CurrentLayer' (both from the AutoCAD nodes) and lace them to the 'CogoPoint.ByGemetry node'. Geometry means a Dynamo geometry object, in this case, a Dynamo point, created with the 'Point.ByCoordinates' node (from Dynamo Geometry nodes). The Point node requires three input values. We’re using a ‘Number sliding’ node for the height of the point, laced to the Z input of the 'Point.ByCoordinates'. We can keep the values for X and Y by the node’s standard values (0). The last missing piece is the raw description. A 'String Input' node will provide this value.

Developing a graph backward from the output is a reasonable approach, as this is also the logic, how Dynamo is evaluating this graph at runtime. In the last step, we rearrange the graph for better readability.

Graph for single COGO point.
Graph for single COGO point.

By using the slider, we move the point in Dynamo and Civil 3D accordingly. This point will later become the peak of the cone.

Creating a Single Cone

A sequence of points will approximate the circle for the bottom. Therefore, we need a 'Circle.ByCenterPointRadius' node (from the Geometry group) and a second 'Point.ByCoordinates' node as well as an additional 'Number slider' for the radius. If we would try to lace the 'Circle.ByCenterPointRadius' node directly to 'CogoPoints.ByGeometry' node we would get an error message, as the node can only accept points.

We need to use a node that can create a sequence of points along the path of the circle. The node 'Curve.PointsAtEqalSegmentLength' can solve this problem. The number of points can be easily adjusted by adding another 'Integer slider' node with a reasonable value (start 6, end 90, step 6 i.e.). The output of this node is a list of points. By lacing the list output into the CogoPoint node, the CogoPoint node takes each of the values provided by the Curve.PointsAtEqalSegmentLength and process it. To get the peak point, as well as the bottom points, processed, we just combine them to a single list with the 'List.Create' node.

We need to add either the start or endpoint of the curve to complete the circle using the 'Curve.StartPoint' or 'Curve.EndPoint' node. As a circle is a closed curve the points are identical, so it doesn't matter which one. We lace this point also to the list. Turn off the preview for the center point and the circle and rename similar nodes for better readability. As now all points for a single cone are created we can define a TIN in Civil 3D using the COGO points.

Graph for a single cone.
Graph for a single cone.

In the next step, we are positioning the cone relative to the origin of the project by moving it in X and Y directions. For testing, let's move the cone 50 m in X respective 10 m in Y provided by two number input nodes. One option would be to move the complete list with a translate node, but it is easier to lace the x and Y values to the input side of the point nodes.

Placing the cone relative to the origin.
Placing the cone relative to the origin.

Creating Multiple Cones

We continue now by placing the cones along a curve (arc). It is much easier to use cylindrical coordinates for points at a curve than cartesian coordinates. Therefore, we replace then node ‘Point.ByCoordinates’ for the center of the circle with a ‘Point.ByCylindricalCoordinates’. We can use this point's X and Y values to control the ‘Point.ByCoordinates‘ node for the peak. The ‘Point.ByCylindricalCoordantes’ has four inputs. We can leave the cs (coordinate system) and elevation empty, using standard values. For the radius, we use the ‘Number.Input’ node. To the input angle, we will provide instead of a single value a list of angles from a ‘Range’ node. The 'Range' node requires three inputs provided by three ‘Number.Input’ nodes. With 0 for the start value, 180 for the end, and 30 for the step, we create a sequence of six angles. We can monitor this by a 'Watch' node.

As the number of points increases now, I recommend changing from Automatic run to Manual run mode, as well as unlace the CogoPoint node and only lace the node back after the geometry creation works perfectly. Thus, we keep Dynamo running fast.

Placing the cone along an arc.
Placing the cone along an arc.

Download the full class handout to continue.

Andreas Luka is a German landscape designer with more than 25 years of working experience. During his career, he worked on high-profile projects in Germany and China as designer, project manager, and design director. He is passionate about new technologies, started as an early adopter of CAD, and is now committed to help landscape teams to master their transition to LIM, the adoption of BIM in landscape design. His approach is pragmatic, collaborative, and focused on fast realization of BIM/LIM's benefits. He trains on related software and implements standards, templates, and procedures. He is also the developer of landscape design add-ins like the LX-Stair application and a frequent contributor to the Autodesk Civil 3D developer forum. He currently works on dynamic trees for Revit and Civil 3D in cooperation with the landscape departments of the Eastern Switzerland University of Applied Science in Rapperswil and Tsinghua University Beijing. Visit http://www.luka-consult.de/about.html for more information.

Partager l'article

Comments