Join the cad line in dynamo

Check out this thread: Join Lines with extend line

In your case group the curves, build a polycurve of each group, and close the polycurve with a line.

2 Likes