Culling geometry outside a set boundary

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)

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)

4 Likes

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

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

1 Like

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.

1 Like

LANDSCAPE.gh (12.1 KB)
I am having problem as the geometry created is only applicable for 4 point surfaces.Iwant to restrict the geometry inside a curved boundary.
Can someone help me?
I have mentioned my trouble in the next pics


As you can see-
in the 1st case curved boundary surface is not working for the code.
while in the 2nd case-
4 point surface is working but the panels are going outside the curved boundary.
Can anyone help me to correct the code?