# Select different pieces from hexagonal grid?

I am just starting to learn the basics of grasshopper and I have this problem, it is complex, hope you guys can give me a hand:

Thanks to this forum I’ve managed to create this parametric grid, now I have to design a way to explode it in pieces of 1,2 and 3 hexagons together. This has to be done in such a way I can input the amount of pieces I want per type: Lets say I want certain (random) combination that will give me 3 pieces of three-hexagons and 4 pieces of two-hexagons and the rest only single-hexagons.

Some people have told me to try Cull Pattern and do it by areas, others to use points, but I can’t even picture the code or the logic behind it in my head. Please help an architecture student here.

Hexagon problem.3dm (38.1 KB)
trigrid.gh (17.6 KB)

Well … this issue of yours is called Islands (*) with variable N of items (most used in classic numerical analysis and/or Matrix ops and/or Steiner Trees and.or … ). Addressable via code … but I have no idea if is doable with native components (unless there’s some add-on around for “similar” Topological results).

(*) i.e. distinct collections of objects kinda like Mesh Disjoined pieces.

On the other hand given a BrepFace with hex modules and a hex center to hex center Connectivity Tree … and some recursion …

BTW: See a classic Random Recursvive Grow on Mesh Faces (could be very easily your hex things as well: the only thing that you need is Connectivity data). Isolating the collections (for “true” Islands) is very easy … but controlling the N of items per collection … well … that could require several lines of code more.

2 Likes