Multiple corridor creation using dynamo

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?

Yep!

And yep again!

3 Likes

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.

2 Likes

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

@felipeguimaraesleal the OverhangCorrectionType is an enumeration, so if you wanted to do the top links you might do something like:

surf.OverhangCorrection = OverhangCorrectionType.TopLinks

2 Likes

Great Python Code. Exactly what i was lookign for.

Thanks Guys,

HI, @mzjensen I have a question about the script above the create multiple corridors. What is the code block node in the image below looking for? The original file says"Surface" is this something that needs to be in the civil 3D drawing? I assume it is the surface target and is a value that does not need to be changed. When I run the script with my files, it generates the corridor but not the surface targets.

That is basically getting all of the possible targets that could be set for all of the subassemblies in a region. The target types are either width, elevation, or surface, and so it is filtering out the non-surface targets. The surface target is actually set here:

So if it isn’t being set, the first thing to check is if you have a surface in the drawing and it is being selected properly in Dynamo. In the image above, it is looking for a surface called “EG”. But that is labeled as an input, so you’d have to change it if your surface has a different name.

Thanks, I got it to work. This is huge for subdivision work or any project with multiple alignments. I had some of those back in 2005 using Autocad Land Desktop.

One more thing. The node below is a Python Script where it creates the surface for the corridors. Is there a way to set up what surface style? I have several surface styles, and the script picks up the “CP-TOPO [ELEVATION BANDING]” style, but I am not sure where the style is defined.
Thanks

It’s probably just taking the first available style or the default from a setting somewhere. You could use the Camber package to set the style after creation.

SurfaceStyles

You’re right. I already have a script to set up the styles, and the surface style is there.

Hey man! Thank you so much. I will have more questions as I keep learning this program.

The following items on my list are Pipe Networks and Cross Section views.

1 Like

Hi, @mzjensen first of all thank you for sharing your scripts. I have a doubt concerning the creation of multiple regions on a single baseline. If I generate the corridor by names and those names are within the script as strings everything works fine. All the regions are generated.


But if I try to read the names of the alignment, profile, etc from the Excel file I only get the 1 region. I even tried to use CorridorExtensions.ByAlignmentProfile but I get the same result:
Do you have any ideas why this is happening? Thank you.

@mzjensen why addcorridorsurface node don’t include overhang I wish you add in this node not in anther node