Reorganise a grid of rectangles, so that they are numbered along a spiral within the same grid


So I have produced an adjustable grid of rectangles and I would like to organize these rectangles into a list order that follows a spiral pattern on the same grid. (I’m not so bothered here about the direction of the spiral, or whether the spiral goes from an outer corner to the centre, or from the centre outward.)

The end-game is to apply a regular pattern of colors to the squares that follows the path of the spiral. In order to do this the rectangles would have to be numbered in order along the spiral.

See example.

Being new to Grasshopper I’m not sure where to start.

Any ideas?

Many thanks!

Grid generator_R5.3dm (29.8 KB)
Grid (6.9 KB)

sort along curve.

Grid (12.0 KB)


Blimey that was quick. Very much appreciated Erick! :slight_smile: