Cuboids from Grids

Hi :slight_smile:
I was hoping someone here could help me with one issue. I have been working on a script that is supposed to create cuboids/boxes out of the Revit grid system. I imported the grid curves into Dynamo, sorted them from bottom left corner created intersections (points), then always lists of four points using list shift indices, then polylines by points, patch and thicken. That is not a problem until the situation when the box has to go over one or more grids as shown in the picture(Zones). Some of the grids are split or shorter and in that situation, the box is going over two or more fields.

Any ideas?

Thank you.

Lucie

Grids sample.rvt (1.4 MB) Grids_Sample.dyn (62.5 KB)