Generating rectangle from a center point instead of a corner point while controlling distance between each rectangle

hi,

I am trying to generate an array of panels from a center point. I have found a way to do this by using a rectangular grid by using the following script:

This creates a grid of rectangle from a centre point as such:

image

In this case it works fine. However i want to make panels out of the grid and control the distance between the panels. I managed to do this with the following code:

This allows me to generate panels from a grid and allows me to control the size of the panels as well as the distance between them as such:
image

In this case however, the grid starts from a corner point. What i want is the grid to start from a center point as the first example. When i try to combine both codes it works somewhat but the panels dont seem to start from a center point (in this case (0, 0). Any idea how to solve this?

image
combined script.gh (13.2 KB)

Hi @serabouch,

I guess something like this would be an overall more practical approach:

First you draw a regular rectangle grid, then you introduce the cell spacing, and after that you move the grid cells back to the origin (cf. green dot).

Hope this helps!

centered_spaced_rectgrid_v1.gh (10.8 KB)

1 Like

Yup this is exactly it. Ill spend time and try to understand exactly how this works. Thanks a lot!

1 Like