Find element (wall) closest to or overlapping with coordinate?

Hi,

quick question

I need to find the element closest to or overlapping with a coordinate (x,y,z).

How would this be done?

Hi, you have to show some work yourself, but a hint could be to check out the Geomtery.ClosestTo node in Clockwork package! :slight_smile:

I tried to make a nice simple descriptive image with only a few nodes and few walls in revit, but after 3 random Dynamo crashes I gave up. :-S

I’m looking for something similar to the Geometry.ClosestPointTo node, I just need the element, not the geometry of the element. :slight_smile:

I need it for a large Revit model with many elements, so I was hoping not to use the geometry if that’s possible…

Here you go, try this solution.
The point by coordinate can be replaced with retrieving points from other elements.

ClosestTo.py (196 Bytes)

1 Like

Well, never give up, Thomas! :wink: You will have to do some kind of geometrical evaluation one way or another, I think. Maybe the raytracer? Here’s a quick and dirty script, that doesn’t solely rely on the walls centroid:

1 Like

Good idea from @jostein_olsen to feed it with several points… I have revised my solution taking several points :slight_smile:

ClosestTo2.dyn (7.5 KB)

1 Like

…or feed it with several elements of different categories.

ClosestTo3.dyn (8.2 KB)

…and if you need the closest element per category per point

ClosestTo4.dyn (14.7 KB)

I finally found time to look at your answers and they both works brilliantly. Thanks, @jostein_olsen and @erfajo

Hei
I have several Elements of category Duct.Accessories in a Space. I am trying to get the Duct.Accessori that is closest to a line endpoint in the same Space. Eks. if i have tree Duct.Accessories i get tree elements from the OUT port of the script.
How can i get the only one that has the closest distance from the line endpoint ?