Help with rs.AddRectange and Python

Hi there,

I am new to grasshopper and python. My apologies for lack of terminology.

Currently trying to create a simple square that nests within a square etc. I have gotten to creating a grid of points but don’t know how to create a rectangle using the points as the four corners.

Is there someone who can tell me what rs.rectangle script I need to achieve this? Even a website reference would be good as I cannot find anything!

Thanks in advance!
dpsr6cx1mvt51|690x355

If you have 4 points in order, you can create the rectangle with rs.AddPolyline([pt0,pt1,pt2,pt3,pt0])
The first point in the list needs to be repeated at the end to close the rectangle.

Would this be easier if I could somehow Identify my pt numbers? I was trying out a point matrix too but oddly it wasn’t giving me an error or anything in Rhino

If you want to create a nested subdivision you don’t need a grid. You can make a function that calculates midpoints and create rectangles from there.
I don’t know a function in rhinoscriptsyntax to work with rectangles so I used boundingbox to get the corners. As Helvetosaur said, you can use a polyline to create a rectangle.
I hope this helps!

20201023_recursive_subdiv.gh (5.6 KB)