Grid intersection with family

Hi all,

I am trying to create a script that allows me to get location of family wrt nearest gridlines.
The error i got was number of items did not match number of keys. (In the test case below, the number of family instances and grid intersections are 5 and 4 respectively)

Below is a snapshot of the script.

Any help will be appreciated ! thanks! :slight_smile:

@JHJHJHJH You could quite easily ensure that the list lengths match

1 Like

Hey @Vikram_Subbaiah !
That worked well for a awhile! … Until I added more random grids. :sweat_smile:

Below are the attached files I’m using, any idea what could have caused the error?

FamilyNearestGridLocation.dyn (24.2 KB)
Grid_intersect_test.rvt (1.7 MB)

Sincerely,
Han

If you need the location of each family according to the nearest gridlines why bother finding the intersection of the gridlines?
You can measure the distance from the location of each family instance to each gridline in the 2 groups then just pick the nearest of each group.

1 Like

This is what I meant :

FamilyNearestGridLocation.dyn (24.4 KB)

1 Like

@viktor_kuzev RIGHT! Now that you pointed that out, thats so much more efficient!
Thanks alot for your help viktor! :slight_smile:

Sincerely,
Han

Hi guys,

I just found this post and I believe it was created for the similar purpose as mine. The only difference is that I would like to rename the family in the “comments” parameter with its grid line location. Could some one help me to get it sorted?

Thanks.

I actually changed the script and it worked out, but I would like that the intersection was shown D 3-4.


Then after the sorting by distance pick the first 2 items instead of only the 1st one then change the string concatenating expression

Sorry Viktor I’m a bit begnner at Dynamo I didn’t get you meant. Sould I change something in this??

Thank you for your support.


Here instead of List.FirstItem you could use List.TakeItemAtIndex, get the first 2 indices - these will be the first two closest grids. then in the code block after you would need to change the concatenating expression a little bit