# Begin and endpoint of a wall linked to the closest intersection of grids

Hi all,

I want to have the names of the closest intersection of the grids at both ends of the wall in two parameters, but I’m stuck with my script.
I can find X and Y coordinates of a certain type of wall, I can find X and Y coordinates of the grids, but does anyone know how to link both?

I want to know the closest intersection of grids to both ends of the wall.
This is my script so far:

1 Like

You need to apply some ‘computational thinking’. For example, (assuming the grids are not rotated from world XY) you could:

1. Extract the X and Y coordinate (start, mid, end it doesn’t really matter) of each grid Line as ordered lists where the indexes map to A, B, C respectively and the names of the grids themselves
2. Create start and end points on the wall curves and project them to the nearest grid in both X and Y dimensions (`Geometry.DistanceTo` or `Geometry.ClosestPointTo` are possible options)
3. Use the resultant X and Y of the projected start/end points as keys to access the relative index from the grid list created in step 1 to return its name
4. Write this data to your wall parameter

If you know how to code this problem is far more easier to solve than you might think. Using visual programming is going to be pretty cumbersome for what is largely a relatively straightforward problem.

It would be simpler to code this indeed, but I found the challenge interesting and I built something that seems to work:

The png should be clear enough (if you open it in a new window or download it). If you have the patience to rebuild it, I’ll be glad to answer to any question.

String.Contains and Clear List are from Archi-lab Grimshaw, Geometry Intersection is from Dynamo4MEP, All Elements of Family Type (Universal) is from Clockwork and finally, Springs.Dictionary.ByKeysValues is from Spring Nodes.

5 Likes

Hello @joris.vanbossche, here is my suggestion.

WallAndBeam.ReportLocation

Select a wall or a beam and click run. (F5)

• Grids must to be perpendicular to each other and parallell with Revits X and Y direction.
• Grids must be numbered from the lower left corner
• Units: mm
• You can choose if you want to report the closest grid intersection or include the distance to it as well.
• It uses out of the box (OOTB) nodes only

WallAndBeam.ReportLocation2.dyn (46.1 KB)

4 Likes

@joris.vanbossche
Hello, some more explanation about what you found useful here would be interesting for everyone…

Hi @Yna_Db,
I used your script as a base for my final result. The biggest advantage of your script is that it was possible to find the closest intersection point of a grid independent of the oriëntation of the wall.

Because in my project I had to have different result for walls with x-direction and y-direction I had to add more nodes, but I got it working. Thanks for your help!

1 Like

Puede compartir el nodo por favor la imagen no se muestra…

gracias