Creating a series of rectangles from a variable depth list of lists of corner points

Hello. I am trying to create a rectangle at the thresholds of doors. My script selects all doors into a room and creates points at each corner of the threshold. So I have a list of lists of these points.
Dynamo dot-to-dot question|635x499

Now the question is how to form a rectangle from each series of (4) points which can then define a surface. As the number of doors into a given room varies, the number of indices in the list of lists varies.
Any help is greatly appreciated !

Try feeding your groups of points into the :snowflake:_Sort Points as Perimeter node from the Sastrugi package.
This node takes a list of unsorted Points and orders them (clockwise/anti-clockwise around a centroid) to create a Perimeter. Useful for creating Polycurves and Surfaces. :+1:t2:

Thanks Ewan. That node seems to add more depth to my list of indexes rather than less.
So I’m trying to use the “Surface.ByPerimeterPoints” node to generate the surface and I get a “Points are coincident” error. I’m basically trying to do exactly what is in this thread : Get windows and door coordination and I’m stuck at the part where the guy says " OK, now I have a closed polycurve." I can’t get that polycurve or anything resembling it.

Can you post a screenshot of your current dyn? The link up above isn’t working for me.


Here’s the whole dyn.
The final “surface.byperimeterpoints” is giving me a “points are coincident” error. I can’t find another way to get the door thresholds as a surface. The idea is to add those surfaces to the overall floor.

Looks like you need a list.map with a flatten function or a Transpose node (or both) on the last output before trying to make the surface, so you have groups of 4 points in each list item. Then if points are still coincident check what is removed when a Prune.Duplicates node is used?

Happy New Year Ewan ! I only just got back into it and tried your suggestion and you nailed it ! I need to clean up some of my room boundaries now cos it looks like I get errors when transitioning from walls to “room separator lines” but I am getting surfaces !

1 Like