Dynamo
Primer for v2.0
English
English
  • About
  • Introduction
    • What is Dynamo & How Does It Work?
    • Primer User Guide, Dynamo Community & Platform
  • Setup for Dynamo
  • User Interface
    • Workspace
    • Library
  • Nodes and Wires
  • Essential Nodes & Concepts
    • Index of Nodes
    • Geometry for Computational Design
      • Geometry Overview
      • Vector, Plane & Coordinate System
      • Points
      • Curves
      • Surfaces
      • Solids
      • Meshes
    • The Building Blocks of Programs
      • Data
      • Math
      • Logic
      • Strings
      • Color
    • Designing with Lists
      • What's a List
      • Working with Lists
      • Lists of Lists
      • n-Dimensional Lists
    • Dictionaries in Dynamo
      • What is a Dictionary
      • Dictionary Nodes
      • Dictionaries in Code Blocks
      • Revit Use-Cases
  • Custom Nodes & Packages
    • Custom Nodes
      • Custom Node Introduction
      • Creating a Custom Node
      • Publishing to Your Library
    • Packages
      • Package Introduction
      • Package Case Study - Mesh Toolkit
      • Developing a Package
      • Publishing a Package
      • Zero-Touch Importing
  • Dynamo for Revit
    • The Revit Connection
    • Selecting
    • Editing
    • Creating
    • Customizing
    • Documenting
  • Dynamo for Civil 3D
    • The Civil 3D Connection
    • Getting Started
    • Node Library
    • Sample Workflows
      • Roads
        • Light Pole Placement
      • Land
        • Service Placement
      • Utilities
        • Rename Structures
      • Rail
        • Clearance Envelope
      • Surveying
        • Point Group Management
    • Advanced Topics
      • Object Binding
      • Python and Civil 3D
    • Dynamo Player
    • Useful Packages
    • Resources
  • Dynamo in Forma Beta
    • Set Up Dynamo Player in Forma
    • Add and Share Graphs in Dynamo Player
    • Run Graphs in Dynamo Player
    • Dynamo compute service differences with Desktop Dynamo
  • Coding in Dynamo
    • Code Blocks and DesignScript
      • What's a Code Block
      • DesignScript Syntax
      • Shorthand
      • Functions
    • Geometry with DesignScript
      • DesignScript Geometry Basics
      • Geometric Primitives
      • Vector Math
      • Curves: Interpolated and Control Points
      • Translation, Rotation, and Other Transformations
      • Surfaces: Interpolated, Control Points, Loft, Revolve
      • Geometric Parameterization
      • Intersection and Trim
      • Geometric Booleans
      • Python Point Generators
    • Python
      • Python Nodes
      • Python and Revit
      • Setup Your Own Python Template
    • Language Changes
  • Best Practices
    • Graph Strategies
    • Scripting Strategies
    • Scripting Reference
    • Managing Your Program
    • Efficiently Working With Large Data Sets In Dynamo
  • Sample Workflows
    • Getting Started Workflows
      • Parametric Vase
      • Attractor Points
    • Concept Index
  • Developer Primer
    • Build Dynamo from Source
      • Build DynamoRevit from Source
      • Managing and Updating Dependencies in Dynamo
    • Developing for Dynamo
      • Getting Started
      • Zero-Touch Case Study - Grid Node
      • Executing Python Scripts in Zero-Touch Nodes (C#)
      • Going Further with Zero-Touch
      • Advanced Dynamo Node Customization
      • Using COM (interop) types in Dynamo Packages
      • NodeModel Case Study - Custom UI
      • Updating your Packages and Dynamo Libraries for Dynamo 2.x
      • Updating your Packages and Dynamo Libraries for Dynamo 3.x
      • Extensions
      • Defining Custom Package Organization for Dynamo 2.0+
      • Dynamo Command Line Interface
      • Dynamo Integration
      • Developing For Dynamo For Revit
      • Publish a Package
      • Build a Package from Visual Studio
      • Extensions as Packages
    • Pull Requests
    • Testing Expectations
    • Examples
  • Appendix
    • Frequently Asked Questions
    • Visual Programming and Dynamo
    • Resources
    • Release Notes
    • Useful Packages
    • Example Files
    • Host Integration Map
    • Download PDF
    • Dynamo Keyboard Shortcuts
Powered by GitBook
On this page
  • Goal
  • Key Concepts
  • Version Compatibility
  • Dataset
  • Solution
  • Get Distribution Main Geometry
  • Get Lot Line Geometry
  • Generate Insertion Points
  • Get Connection Points
  • Create Objects
  • Result
  • Bonus: Enable Sequential Placement
  • Ideas
Edit on GitHub
Export as PDF
  1. Dynamo for Civil 3D
  2. Sample Workflows
  3. Land

Service Placement

PreviousLandNextUtilities

Last updated 1 year ago

The engineering design of a typical housing development involves working with several underground utilities, such as sanitary sewer, storm drainage, potable water, or others. This example will demonstrate how Dynamo can be used to draw the service connections from a distribution main to a given lot (i.e., parcel). It is common for every lot to require a service connection, which introduces significant tedious work to place all of the services. Dynamo can speed up the process by automatically drawing the necessary geometry with precision, as well as providing flexible inputs that can be adjusted to suit local agency standards.

Goal

Key Concepts

  • Using the Select Object node for user input

  • Working with Coordinate Systems

  • Using geometric operations like Geometry.DistanceTo and Geometry.ClosestPointTo

  • Creating Block References

  • Controlling object binding settings

Version Compatibility

This graph will run on Civil 3D 2020 and above.

Dataset

Start by downloading the sample files below and then opening the DWG file and Dynamo graph.

Solution

Here's an overview of the logic in this graph.

  1. Get the curve geometry for the distribution main

  2. Get the curve geometry for a user-selected lot line, reversing if necessary

  3. Generate the insertion points for the service meters

  4. Get the points on the distribution main that are closest to the service meter locations

  5. Create Block References and Lines in Model Space

Let's go!

Get Distribution Main Geometry

Our first step is to get the geometry for the distribution main into Dynamo. Instead of selecting individual Lines or Polylines, we'll instead get all of the objects on a certain layer and join them together as a Dynamo PolyCurve.

If Dynamo curve geometry is new to you, take a look at the Curves section.

Get Lot Line Geometry

Next, we need to get the geometry for a selected lot line into Dynamo so we can work with it. The right tool for the job is the Select Object node, which allows the user of the graph to pick a specific object in Civil 3D.

We also need to handle a potential issue that may arise. The lot line has a start point and an end point, which means that it has a direction. In order for the graph to produce consistent results, we need all of the lot lines to have a consistent direction. We can account for this condition directly in the graph logic, which makes the graph more resilient.

  1. Get the start and end points of the lot line.

  2. Measure the distance from each point to the distribution main, then figure out which distance is greater.

  3. The desired result is that the start point of the line is closest to the distribution main. If that isn't then case, then we reverse the direction of the lot line. Otherwise we simply return the original lot line.

Generate Insertion Points

It's time to figure out where the service meters are going to be placed. Typically the placement is determined by local agency requirements, so we'll just provide input values that can be changed to suit various conditions. We're going to use a Coordinate System along the lot line as the reference for creating the points. This makes it really easy to define offsets relative to the lot line, not matter its orientation.

If Coordinate Systems are new to you, take a look at the Vector, Plane & Coordinate System section.

Get Connection Points

Now we need to get points on the distribution main that are closest to the service meter locations. This will allow us to draw the service connections in Model Space so that they are always perpendicular to the distribution main. The Geometry.ClosestPointTo node is the perfect solution.

  1. This is the distribution main PolyCurve

  2. These are the service meter insertion points

Create Objects

The last step is to actually create objects in Model Space. We'll use the insertion points that we generated previously to create Block References, and then we'll use the points on the distribution main to draw Lines to the service connections.

Result

When you run the graph you should see new Block References and service connection lines in Model Space. Try changing some of the inputs and watching everything update automatically!

Bonus: Enable Sequential Placement

You may notice that after placing the objects for one lot line, selecting a different lot line results in the objects being "moved."

This is Dynamo's default behavior, and it is very useful in many cases. However, you may find want to place several service connections sequentially and have Dynamo create new objects with each run instead of modifying the original ones. You can control this behavior by changing the object binding settings.

Take a look at the Object Binding section for more information.

Changing this setting will force Dynamo to "forget" the objects that it creates with each run. Here's an example of running the graph with object binding turned off using Dynamo Player.

If Dynamo Player is new to you, take a look at the Dynamo Player section.

Ideas

Here are some ideas for how you could expand the capabilities of this graph.

Place multiple service connections simultaneously instead of selecting each lot line.

Adjust the inputs to instead place sewer cleanouts instead of water service meters.

Add a toggle to allow for placing a single service connection on a particular side of the lot line instead of both sides.

Place water service meter Block References at specified offsets from a lot line, and draw a Line for each service connection perpendicular to the distribution main.

Mission accomplished!

🎯
🎉
111KB
Land_ServicePlacement.dyn
842KB
Land_ServicePlacement.dwg
Getting the objects from Civil 3D and joining everything together into a single PolyCurve
Selecting a lot line and ensuring that it is the right direction
Creating the insertion points for the service meters
Getting perpendicular points on the distribution main
Adjusting the input parameters in Dynamo and immediately seeing the results in Civil 3D
Behavior when object binding is turned on
Dynamo's object binding sesttings
Running the graph using Dynamo Player and seeing the results in Civil 3D