# 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 _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.

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