Rename Structures
Last updated
Last updated
When adding Pipes and Structures to a Pipe Network, Civil 3D uses a template to automatically assign names. This is usually sufficient during initial placement, but inevitably the names will have to change in the future as the design evolves. In addition, there are many different naming patterns that might be required, for example naming Structures sequentially within a pipe run starting from the furthest downstream Structure, or following a naming pattern that aligns with a local agency's data schema. This example will demonstrate how Dynamo can be used to define any type of naming strategy apply it consistently.
🎯 Rename Pipe Network Structures in order based on the stationing of an Alignment.
Working with Bounding Boxes
Filtering data using the List.FilterByBoolMask node
Sorting data using the List.SortByKey node
Generating and modifying text strings
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.
Select the Structures by layer
Get the Structure locations
Filter the Structures by offset, then sort them by station
Generate the new names
Rename the Structures
Let's go!
The first thing we need to do is select all of the Structures that we plan to work with. We'll do this by simply selecting all of the objects on a certain layer, which means that we can select Structures from different Pipe Networks (assuming they share the same layer).
This node ensures that we don't accidentally retrieve any undesirable object types that might share the same layer as the Structures.
Now that we have the Structures, we need to figure out their position in space so that we can sort them according to their location. To do this, we'll take advantage of the Bounding Box of each object. The Bounding Box of an object is the minimum-sized box that fully contains the geometric extents of the object. By computing the center of the Bounding Box, we get a pretty good approximation of the Structure's insertion point.
We'll use these points to get the station and offset of the Structures relative to a selected Alignment.
Here's where things start to get a little tricky. At this stage, we have a big list of all the Structures on the layer that we specified, and we chose an Alignment that we wanted to sort them along. The trouble is that there may be Structures in the list that we don't want to rename. For example, they may not be part of the particular run that we are interested in.
The selected Alignment
The Structures that we want to rename
The Structures that should be ignored
So, we need to filter the list of Structures so that we don't consider those that are greater than a certain offset from the Alignment. This is best accomplished using the List.FilterByBoolMask node. After filtering the list of Structures, we use the List.SortByKey node to sort them by their station values.
If you're new to working with Lists, take a look at the Working with Lists section.
Check to see if the Structure's offset is less than the threshold value
Replace any null values with false
Filter the list of Structures and stations
Sort the Structures by the stations
The last bit of work that we need to do is create the new names for the Structures. The format that we'll use is <alignment name>-STRC-<number>
. There's a few extra nodes here to pad the numbers with extra zeros if desired (e.g., "01" instead of "1").
And, last but not least, we rename the Structures.
Here's an example of running the graph using Dynamo Player.
If Dynamo Player is new to you, take a look at the Dynamo Player section.
🎉 Mission accomplished!
It can be helpful to take advantage of Dynamo's 3D background preview to visualize the graph's intermediate outputs instead of just the final result. One easy thing we can do is show the Bounding Boxes for the Structures. In addition, this particular dataset has a Corridor in the document, so we can bring the Corridor Feature Line geometry into Dynamo to provide some context for where the Structures are located in space. If the graph is used on a dataset that doesn't have any Corridors, then these nodes will simply do nothing.
Now we can better understand how the process of filtering the Structures by offset works.
Here are some ideas for how you could expand the capabilities of this graph.
Rename the structures based on their closest Alignment rather than selecting a specific Alignment.
Rename the Pipes in addition to the Structures.
Set the layers of the Structures based on their run.