Multiple corridor creation using dynamo

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)