Culling geometry outside a set boundary

unhandled

(Calmunrogue) #1

Hi all,

I was wondering if anybody could help me with an issue I am having. I want my hex grid to be constrained within a curve, and all hexagons outside the grid to be removed, but I am having trouble making this happen.

This is my current script, and what I now want to do with it is constrain it within a selected curve, and then cull the hexagons that are outside or on the boundary of the curve, similar to this:

So far my attempts att culling the excess hexagons has not been very successful, so any help would be much appreciated.

hex_attractor point.gh (11.1 KB)


(Michael Pryor) #2

You didn’t internalize your data so your attached file is pretty useless.

However the issue is easy to replicate. I would first test the center point (use polygon center, it’s faster than area), Then test if the remaining geometry intersects the boundary.

Inside.gh (18.1 KB)


(Calmunrogue) #3

Hi Michael,

Thanks for the help!

Your script makes perfect sense and I understand the logic, however when I switched the rectangles out for a hexagon grid, it doesn’t cull the exterior hexagons, and I don’t know why.

Based off the script you posted, I managed to combine it with what I had, and it almost works, however the hexagons outside the boundary curve are not culled. I am sure this is an easy fix, I am just unsure on how to do it. I have also included my new script, this time hopefully with the internalized data. hex_attractor point_2gh.gh (26.1 KB)

Any help would be appreciated,

Regards, Callum


(Michael Pryor) #4

It works fine. I think you are forgetting to turn off the component previews for the other components.


(Calmunrogue) #5

Hey Michael,

Oh dear, I knew it was something super simple, thanks for the help! I have got my script up and running nicely now. Added a more advanced cull pattern to based on a tutorial found here.

Some of the patterns generated:

Regards, Callum.