Topic: Grouping Lines in Civil 3D Using Dynamo to Create Closed Polylines

Hi everyone,

I’m looking to group lines in Civil 3D using Dynamo to create closed polylines. These lines represent building outlines, and I think the key is to check the start and end points to group them correctly. Does anyone have any ideas on how to solve this task? Any help or suggestions would be greatly appreciated!

Thanks in advance!

Polycurve.ByGroupedCurves should work if your data is clean. If it isn’t clean (meaning more than two lines share an endpoint) you’ll have to clean it before processing.

I used this for cleaning polylines when imported from ArcGIS-polygon-shapefiles (Those polygons would always come in with a duplicate coordinate for start- and endpoint):

…with the code for “Remove duplicates” being

mypoints = IN[0]
ptsclean = []

for pt in mypoints:
    ptsclean.append(list(dict.fromkeys(pt)))

OUT = ptsclean