# Find closest floor

So this time I was trying to determine installation height of some equipment and write it into its parameter. I came across this thread Find element (wall) closest to or overlapping with coordinate? but I actully need to find not the closest one, but the one which lays right beneath the piece of equipment, because the closest one’d be the one right above it. Moreover Geometry.DistanceTo node calculates the distance incorrectly likely because of base point offset, but once I find the needed floor I’ll be able to calculate the distance from bounding boxes I suppose. But how’d I find it?

Is it possible to search by level, so all equipment on level 2 search for closest floor with a base of level 2 and so on?

Well, the thing is that floors in different rooms have various heights and are located at different levels as well, so that’d be just manual picking

I can think of a couple of roundabout methods but none that seem efficient.

If there is nothing between the equipment and the floor you could use raybounce on a view where everything except the floor and the equipment categories are hidden.

Another would be to use the location of the equipment, create a vector/line going straight down and find which floor it intersects with the shortest distance.

One that would be less resource intensive (I think) would be to get all of the bounding boxes of the floors, find which one the equipment’s x and y are located within, and then the closest but less than Z. This would be a problem if there is an odd/concave/circle shaped floor though.

2 Likes

Well, this idea with RayBounce kind of worked, except several instances where dynamo wasn’t able to detect a second storey floor beneath the fixture for some unknown reason) anyway it’s still easier than measure the height manually

1 Like