Skip to main content

Tunnel modeling with Dynamo


Last week I had a nice conversation with one of my Italian friends. The focus of the conversation was how to model a tunnel in Revit starting from an Excel list of points coming out from Civil 3D.
So the answer was: Dynamo of course!

First input, the section of the tunnel with his diameter; I can't share the details but lets say that we have:

  • Theoretical excavation profile: 200 mm 
  • Precast segment thickness: 500 mm
Whit this two elements and the excel of the theoretical cent alignment, we can do everything!

Revit profile family

The first family we're going to create is a simple circle profile with a diameter parameter. This family will be as a mass category to be able to nest it later in an adaptive component family for the tunnel. 
Just save this family...easy!

Tunnel model

Now we can create a new family as generic adaptive component and load the profile just created. It's important that the family is able to host rebars for future structural modeling.
Whit these elements ready we can start the first script for Dynamo. This script is basically reading a list of normalized point coming from Civil. We need normalized points just because we want our tunnel placed exactly in the origin of the family so, we'll be able later to place it in shared coordinates in the project.
I can't show you the list of points but, it will be easy to understand how this is made: is an Excel worksheet with PENZ format (point name, east, north and elevation)
Then we can read points from the excel and according to the percentage of points that we want to use, recalculate the location of point at equal distance on the curve.
As always when it comes to curves, we need to calculate direction and normal of the curve on specific points. 
It's easy to do it just finding to points very close to each other and find a vector between two points. Then the normal is just the cross product between this vector and the Z axis :)
For the last point I used a little trick, reverting the direction of the curve to find the point for the direction, otherwise, there're no points after that and you won't be able to calculate the vector. 
Before placing the profile, we need the rotation as well, and to this angle we can calculate the angle between the direction of the curve and the X axis (because the family profile is created as orthogonal to this axis)
Finally we can place the profiles for both the solid and the void. We'll need two solids and two voids to achieve the result. I put this two elements in the same family but, it will be better keep it as separate elements and separate families.
Just a little bit of colors (materials) because life is better with colors!
And this is the final result
Sometimes the void is not cutting the solid automatically so, you need to manually cut with Revit tools.

Now just save the family and load this family into a new project.

The project

So place the model in the correct location is easy, we can just use a family by point node and select the tunnel family that we just put in the project.

Last but not least we can adjust the correct project base point to match the real coordinates.


Now that we have our model placed correctly we need to create sections, both cross and longitudinal.
Those sections should be aligned to the alignment and with a predefined distance.
Dynamo again is the key for the success. We'll use same alignment to find those points and place a section view following the normal vector that we already calculated previously. 
For this example I chose to have cross sections each 5 meters and long sections each 15 meters. Then we can choose to start from the beginning of the alignment or from the end, it depends on the alignment direction.
Again we calculate direction, normal and with these point we can place the sections in the correct way. To create a section we need two points as a bounding box. I used to have a buffer to identify the far clip plan and the section diameter to create the right section dimension.
Just a little bit of string manipulation to have a  good name for the sections.!
150 sections just in one click and perfectly aligned to you model, this is awesome, isn't it?
Thanks Dynamo :)
As always everything ready for you to try, except the excel file because is related to real data.

Enjoy and see you on the next tutorial.


  1. Hi Cesare ...The uploaded file link seems to have expired ..Care to upload again ?
    Thanks and regards,

  2. Hi Cesare
    Great Tutorial
    I try to create sections in the project, but it's possible that between the picture 1 and 2 is missing a another photo??
    Thanks for all

  3. Hello Cesare, is it possible to update the link to download the content?

  4. Hi Cesare,

    Great tutorial, could you upload or share the download link again? It seems to have expired.

    Thanks in advance.

  5. Very great post. I simply stumbled upon your blog and wanted to say that I have really enjoyed browsing your weblog posts.


  6. Hi Cesare,

    Good Day. Hope ypubare well. This blog of yours is very interesting. Could you please share some tips and tricks on tunnel modelling like this blog you have here. It would be a big help with the current project I am in.


  7. Hi Cesare!

    Great post. I´ve been looking for something like this in a while. I wanted to ask if you can upload the link again, apparently it´s expired.



  8. Hi Cesare,

    Thanks for sharing. Seems that the link for the script is expired, can i ask for a new link so that i can learn how to do it.


  9. Thanks for the best content
    Bim consulting USA

  10. Thanks for the best content.
    If you can, Could you send me the file..? Because i can't not download..


Post a comment

Popular posts from this blog

Dynamo, Revit, Excel, UI...what a wonderful day!

Introduction Today I'll show you two examples of how to use Dynamo to export existing Revit schedules and how to compose a custom schedule on the fly, to be exported to Excel.
Both of them with a very nice graphical user interface thanks to Data-Shapes ( package.
Export Schedules Let's start from the easier. The idea behind this script is to export a list of existing schedules to an Excel file, creating for each schedule a separate tab. To be able to complete this script you'll need two packages: Data-Shapes for the graphical interfacesBimorphNodes to extract schedules data The script is very easy and you have to focus only on how to create an interface Then you can use your input to feed the next nodes. Finished! So just push the run button (or use Dynamo Player is you are in Revit 2017.1 or 2017.2) and enjoy the interface.

Export parameters to Excel In the second script I'll focus on something more interesting. Many times we need to just extr…

Multi-pipe support configurator with Dynamo

As always everything is coming from my childhood…ops no, that's another story.
As always everything starts on a white recycled paper just in front of my keyboard; a simple idea becomes immediately a sketch with Revit parameters.

I tried many times different kind of plugins for automatic supports placement, but no one of these is able to create a multi-pipes supports (if I'm wrong, please let me know the name of the plugin). The idea for this script in Dynamo, is to create a support for a bounce of pipes going parallel for a while, and create a group that is possible to copy along the path. I'll not focus on the creation of the families that you need for the support but just to explain the main idea, I have 3 different pieces (steel bar, u-bolt and threaded rod) that I'll compose together to create the final support. The first challenge is to align the pipes to the same BOP (bottom of pipe) because they have to stand on the steel bar and locked with the u-bolt.  The bas…