Multiple corridor creation using dynamo

Hello, I have this question on corridor surfaces and boundary. Civil 3D Toolkit Feedback thread - #719 by Drbohlav Do you know about any solution or have any tip?

@Ernest.Villanueva - see this post:

@Ernest.Villanueva see post here for creating EG surface profiles:

Can you open a new post?

1 Like

Here is new post Add boundary to corridor surface

@Ernest.Villanueva - see this post.

@Ernest.Villanueva - see this post:

@Ernest.Villanueva - see this post:

Thank you so much on sharing some of the dynamo scripts. i tried running it in my work and it works! i made some iteration on targeting the surface and it works perfectly. the only thing i need to create are the intersections.

Once again thank you for your support!


Silly question, but can you tell me how you get that “name” variable input onto that code block?

Never mind, I believe I found what I was missing in the Primer. Thanks!

I was also wondering about these to nodes:

Are the Object.Identity nodes basically just allowing you to make a cleaner-looking diagram (very clever idea btw)? Or is there something else more subtle that I’m missing?
And are the [passThrough,waitFor][0]; code blocks (I guess that is DesignScript?) there to keep the operations all executing in the correct sequence?


And yep again!


This is a great code to parse through.
For the Python portion (creating the corridor surface), I see you use Links to create the surface. I would like to make the surfaces using feature lines instead.

In your code, is “links” just the name for a list of string inputs which are the code for the Top Links? (In this case, just “Top”.) If so, then I should be able to swap in its place a list of codes for multiple feature lines instead…?

Of course I’ll have to switch “surf.AddLinkCode(link, True)” with “surf.AddFeatureLineCode(featureLineName)”
Then, can I presume that “featureLineName” would be referring to the 3rd user input, in this case a set of strings, something like [“Top_curb”,“Back_curb”,“Crown”]?

In theory that should work. Give it a try!

Wow, so as expected, its a bit more complicated than I might have thought.
Aside from a few relatively minor reworkings (related to capturing the alignments, and setting stationing, etc.), the two big differences are:

  1. removing the entire portion for the surface daylight targets (temporarily, while I get a better understanding of everything else)
  2. changing the corridor surface from building by Links to Feature Lines

So far, it is successfully naming and creating the Corridors, and creating the Corridor Surfaces; however, it is not naming the Corridor Surfaces correctly (it takes the first name on the list and applies that name to the second CorSurface as well), and the CorSurfaces aren’t having any corridor Feature Lines added to them (so they’re just empty surfaces).

Again, note that I excised the entire Targets portion, and reconnected the nodes as seemed logical. And the Python script was editing to attempt to use Feature Lines instead of Links to populate the surfaces.

I’m obviously getting in a little over my head. Simply swapping “surf.AddLinkCode(link, True)” with “surf.AddFeatureLineCode(featureLineName)” doesn’t appear to be a 1:1 switch, and I must be missing something else that is needed to make it work. At least, I think that’s the case. Maybe it is something in the dynamo workflow? But I believe I reconnected the nodes correctly after removing the Targets portion. I’m still working out exactly how the “passThrough” Code Blocks are affecting the routine.

The dynamo file is attached, and a screen of the edited Python script.
CreateCorridorsAndCorridorSurfaces.dyn (70.7 KB)

Any hints would be greatly appreciated, but I understand I still have a ways to go in really understanding just what I’m doing (lol).

Edit: this routine should work with any drawing that has at least 2 alignments and a profile with each alignment.
Edit2: Also, an assembly named “MAIN” with a “LaneSuperelevationAOR” subassembly included will be needed (for the “Crown” and “ETW” codes).

I haven’t looked at your DYN file, but I can see why the Python node won’t work as written. You’ve replaced ‘link’ with ‘featureLineName’, but you haven’t changed anything else about the function. There is no input to the function called ‘featureLineName’ and therefore no codes to try to add to the surface.

1 Like

Oh I see now, “surf.AddLinkCode(link, True)” is looking for the “link” variable
But “surf.AddFeatureLineCode(featureLineName)” has no “featureLineName” variable

I was confused about where the actual “link” variable was even declared in the Python script. I see “links” declared up at the top, and used subsequently; I suppose the “for link in links” must be where this is introduced.

Anyway, I changed “surf.AddFeatureLineCode(featureLineName)” to “surf.AddFeatureLineCode(link)”, and it both added the correct codes to the surfaces, and fixed the naming of the surfaces.
(I know as a best-practice I should have changed the variable name in the Python Script from “links” to “featlines” or something like that, but I just wanted to minimize the chances of introducing more errors…)

Now, it appears to work as hoped! A couple very minor mysteries, probably having to do with the dynamo workflow: the corridors are left alerting to be rebuilt and the cor-surfaces are not “taking” the shrinkwrap boundary. But I really don’t care, because a manual rebuild-all does the trick for both issues.

Here are the latest:
CreateCorridorsAndCorridorSurfaces.dyn (70.6 KB)

Hello , does anyone try to create a group of corridors from a list of features lines in Dynamo?
Feature lines act as a horozontal and vertical baseline, and can be a really fast method of creating corridors.

Thank you!

Hi @javiermend ,

I don’t think its possible at the moment as we’re currently limited to access alignment/profiles for corridor creation.

In the future, but not so soon I suspect.

1 Like