Revit Dynamo — 3D GridLines For Coordination

Slava Krel
6 min readMar 26, 2021

Recently I came across another interesting challenge of using Dynamo to help BIM coordination process. It is pretty common that working in the BIM environment Project Managers will utilize 3D gridlines. These gridlines give users the best visual understanding of where they are in the model whether they are in Revit or Navisworks.

Pic. 1. Left — Navisworks view, Right — Revit 3D view.

While Navisworks represents levels and grids in 3D by default, Revit only reveals levels and not grids. IMHO, the grid representations in Navisworks are useless at best, but that’s me. The new 3D gridline is a Revit family that have parameters “Grid” and “Level”. By placing the new 3D gridline family and filling out these parameters, this new family will mimic the Revit grid family and can be seeing in 3D.

Pic. 2. 3D GridLine Properties. “Grid” and “Level” — these are the parameters that we are going to change using Dynamo

The challenge was that I want these new 3D gridline families to read the info from the Revit grid and automatically fill out the parameters I need. So I got a chance to make it happen and have decided to blog it down. This is how it works:

Here is the full definition (download it from my github):

Pic. 3. The full definition

Here is a short video that shows how it works:

Video 1. Demo

The custom node (see the pic. 3) is where all the magic happens. The custom node process one 3D gridline at the time. With that said, let’s build the script to process one 3D gridline first. Then we will save it as a custom node.

Step 0.

First things first. We need to create a Revit project, draw a few gridlines and add the 3D gridline family to the project. Check my github, I will leave the 3D gridline family there along with the script. Look at the picture below, your project has to look similar to this.

Side note: this script does not work with Revit grids from a linked file, the grids have to be local.

Pic. 4. Prep your Revit project before scripting in Dynamo

Now we are ready to fire up Dynamo!

Step 1.

As a first step we need to make two identical operations and pick up all the Revit grids and 3D gridlines. There are a couple of ways to do it, but I prefer the one when I call the category with a Code Block.

Pic. 5. This is how we select the items we need.

Step 2.

Remember on step 0 we modeled one 3D gridline? We know that this 3D gridline is located exactly where one of the Revit grids are. That’s why we need to find coordinates of both and compare. It is easy to find coordinates or Revit grids by using the Grid.Curve node. The Grid.Curve node will give us start and end points with X, Y and Z coordinates accordingly.

Pic. 6. Retrieve Revit grid coordinates

We will need only one point — start or end — it doesn’t matter.

Step 3.

Great! Now we have the Revit grids coordinates, we will have to find coordinates of the 3D gridlines. Extracting 3D gridline location is a little more challenging. Revit doesn’t have a default node to do it. In order to extract the 3D gridline location I borrowed someone else’s Python script that I found and made some modifications. Please copy the script below and paste it into a Python script node.

For those of you who new to Python this script might look a little overwhelming. Don’t get scared. It does more things than we need for this specific task. It has 9 different outputs, but we will only be using #3 — curve. Similar to Revit grids we will have to use a Curve.StartPoint node to retrieve the actual X, Y and Z coordinates.

There is another Python script that has to be here, but it is not as scary as the first one. This script is a simple loop. It compares each one of Revit grid coordinates to the 3D gridline. If it finds a matching coordinates — it spits out a Boolean “True”. Remember, it will be always only one true value, because we will always compare one 3D gridline to all of the Revit grids. With that said, please copy this code and paste it into a new Python script node.

To check your self — here is what it should look like at the end, make sure you have two Python nodes:

Pic. 7. Retrieve 3D gridline coordinates and compare it with Revit grids

Step 4.

Congrats, the hard part is done! Now we just need to set the name of the 3D gridline according to the Revit grid that has the same coordinates. This procedure is pretty standard. Here is what it looks like.

Pic. 8. Rename 3D gridline

Step 5.

At this step we want to make sure the 3D gridline reflects the correct level.

Pic. 9. Level match

Alright, almost done! Please check it again, you will have to have a complete script that looks like on the picture below:

Pic. 10. This is what it should look like so far

I don’t want to be a pain, but it’s worth to mention this again. This script works only with one 3D gridline. We need to feed this script one 3D gridline at the time. Instead of creating another Python script and make this process more complicated we will build a custom node. Look at the picture above. This new custom node is going to contain part 2, 3, 4, 5, and 6. The part 1 is going to stay outside of the custom node. With that being said let’s roll into step 6.

Step 6.

The picture below shows how to create a custom node.

Pic. 11. Creating a custom node.

Once the custom node is created, go back to the script we have so far (picture 10), select and copy parts 2, 3, 4, 5, and 6. Paste these parts into the new custom node you just created. The last thing we need to do — we need to add the Input node (see the picture below).

Pic. 12. Adding an Input node to the custom node.

Ending

After the script successfully completed you should be able to add as many 3D gridlines as you want to the project and fire up the script.

Pic. 13. Final view

Thank you for reading. I hope you find this post helpful. Feel free to download the script from my GitHub.

--

--