objective / goal : assigning the closest window for each points
I will have multiple points in the building and want to assign windows that are the most closest from the each point. I thought extending multiple lines from each point and find the one that interests with the window with the shortest length will be matched. Eventually I want to connect the corners of the window to the point and make a triangle.
any advice on how to solve this problem?
just the ‘point - window’ match making advice would be very helpful
thank you for your time
Geometry.Intersect and some Index referencing would let you compare your circle-rays to Window Geometry to determine hits. It does get messy with hitting the same window more than once, or not having a large enough radius on the circle-ray creation.
You may want to consider using GetLocation on the Windows. That way your line generation is #Windows * #Reference Points, and you can use Shortest Length methods to associate Windows to the points. It may require a Z-offset check if the project is multi-story and if you want the nearest Window on that level.
I would use the center of the windows bounding box and measure distance from all your points to those.
Closest one is the right window
I use all nodes but this would be cleaner with some design script
Hope this help
Closest.dyn (46.2 KB)
Here is my humble solution. I have considered the facing direction of the windows so that the triangle could be drawn for a window on an inclined wall too.
Kindly note that, for the internal point, I have considered a room->location->patch->pointatparameter so that I could test the point using the sliders. This could be altered according to your requirement.
Dear experts, kindly advise if there is a better way WindowsTriangle.dyn
This is a common problem, try to see this similar post where I explained how to find closest element
Maybe it is not the most performant way, but you just have to take all distances from points to windows (3 x num_of_points distances) and take the minimum item
thank you very much for your time to teach me this script. this is very helpful.
do you know how to get the two points that represents vertical length of the window?
you’ve shown me the lateral which is perfect but I also need vertical.
I tried to figure it out by myself but no good.
thank you very much in advance!