Check multiple element in multiple room


I did a search but maybe just missed it…
I have many object and many room. I want to check all the object and return the room they are in.

So far what I did works fine but slow. Kind of a brute force way to do it. I’m multiplying the element location list by the count of room and I’m checking all element for every room.

What is a better way to do it?

Additional info:

Yes, I have tried the archilab node that it taking the room name but it gives error as many light fixture has a location line not a point. In my script you can see I’m fixing this problem by getting the center point of the location line