grids #1

image by archi-lab

I don’t really know why but…Grids have been on my mind. I know, that sounds weird.

I am not sure why but in my recent Revit en-devours Grids have been a frequent flier. Even though I don’t do a whole lot of Revit/Dynamo work these days, I ran into a question about them on the Dynamo Forum, as well as during a workshop that I was teaching recently. So, I thought that its time to make some Grids, and see what happens. This might turn into multiple posts as I don’t want to cram too much content into a single one. The way I see it, I will talk about Grid intersections in this one, and maybe Grid creation in the next one. So let’s get to it!

This idea came up during the workshop from one of the participants. He had a working solution for creating markers that contained names of two intersecting Grids. The idea was for me to have a look at it, and see if we can make it better. Surprise, surprise…I did have some ideas, but unfortunately Dynamo’s magical list management and lacing stumped me when I was trying to sort this out on the fly, and unfortunately I am no Chuck Norris, so staring at it wasn’t an option.

I might not be like Chuck, but I didn’t exactly give up. So here’s what I came up with a few days later.

Let’s say I got some grids in a file, and they might or might not intersect each other. The task is to sort out what Grid intersect with what Grid, create a marker family at that intersection point, and then set the parameter in said marker family to names of the intersecting grids.

Initial Grids from the sample file.

Let’s kick it off with some simple stuff like selecting all of the Grids in the project using Categories and All Elements of Category nodes. We can then get all of the underlying Curves from the Grids. Please note that when we use Grids as the Category, that returns only simple Line based Grids. All compound Multi-Segment Grids are actually stored in Revit under MultiSegmentGrids Category. This means that we don’t have to do any extra filtering here.

Once we have all of the curves, what I want to do is create two lists that I will intersect against each other. First I am taking the list of all Grids, and duplicating it as many times as there are Grids in the list. So I am effectively creating something like this:

The reason I am doing this, is to create two lists, that I will intersect against each other, but I want to make sure that I am not creating duplicates. If I have just intersected my first list like so:

We would have ended up with a list like this:

That’s now what I wanted. Because this produces duplicates where Grid1 intersects itself, then in second list Grid2 intersects Grid1 yet again even though that was already created in the first list. As you can see, this would have resulted in a mess. Instead, I know that there is a pattern of excluding certain items, from the second list, that will lead me to only singular intersections and no duplicates. That pattern is to remove first item from the first list, first two items from the second list, and all three items from the third list:

If we do that, then we are left with just the unique intersections 1-2, 1-3, 2-3 and no duplicates or self intersections. That’s why I am creating a range of numbers from 1 to length of my list, every 1. Then I can use these numbers to drop 1 item from the first list, 2 items from the second list, and 3 items from the third list. The result is more like this:

If I run intersections on these lists, then I am going to get the results that I need. Next I just have to do the same action on Grid Names, so that I get a matching list of names and we are good to create the Grid markers, and set their parameters:

This should result in the following set of intersection markers:

Resulting Grids and grid markers placed at intersections of Grids.

If we were to zoom in, each of the markers would have the following info:

Close up of grid markers showing what Grid intersection they are at.

This can potentially be useful for Navisworks. I am not sure how many people use it for coordination, but if you do, this workflow might come handy. Personally, I have never used that method, but at the same time I haven’t done a whole lot of coordination in my architect days.

Here’s code for the python bit:

Ps. Special thanks to folks at Gilbane for inspiring this post, and for having me over to teach them Dynamo. It was fun!

Ps2. As mentioned by David Baldacchino on Twitter, there is an alternative way of doing this using a node called List.Combinations. Heck! I didn’t even know that it existed in Dynamo. David was kind enough to post an example of how that component works, and I implemented an alternative solution really quickly. No Python needed!

Support archi-lab on Patreon!

Leave a Comment