Service Placement
Last updated
Last updated
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.
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
This graph will run on Civil 3D 2020 and above.
Start by downloading the sample files below and then opening the DWG file and Dynamo graph.
Here's an overview of the logic in this graph.
Get the curve geometry for the distribution main
Get the curve geometry for a user-selected lot line, reversing if necessary
Generate the insertion points for the service meters
Get the points on the distribution main that are closest to the service meter locations
Create Block References and Lines in Model Space
Let's go!
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.
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.
Get the start and end points of the lot line.
Measure the distance from each point to the distribution main, then figure out which distance is greater.
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.
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.
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.
This is the distribution main PolyCurve
These are the service meter insertion points
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.
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!
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.
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!