Find closest element

I’m trying to find the closest element to an element in a Plan View.
In my situation you see 1 Level with Structural Columns under and above this Level. They do not clash and the number of columns above/under Level is not always the same.
I’ve the script but I got an AttributeError: “‘float’ object has no attribute ‘index’”.
Can anyone help me with this script?



find closest columns.dyn (43.8 KB)
test_columns.rvt (5.0 MB)

Hi @mrl, it’s not entirely clear to me what you are trying to achieve with that Python script, but to find the closest element to a point (or another element), I suggest sorting the elements by their distance to that point and grabbing the first item in the sorted list.

1 Like

@mrl If you are not inclined to go for a Python solution, you can try something like this with the node from springs node package: find closest columns.dyn (13.8 KB)

3 Likes

Thank you @AmolShah .
This is what I’m looking for. With this script I’ve found the nearest element-ID.
:+1:

1 Like