Divide cube GH

Hello everyone,

I am new here and I am learning Grasshopper.
I am looking to subdivide cubes using one or more attractor points.
(see the attached screenshot)

Does anyone have an idea how to do this?

Thank you all for your help,

how many times do you want do divide the faces?
i would try with

divide domain2 - isotrim

to divide the first cube in 4 faces

then use surface closest point in some way

These subdivisions are iterative (the same algorithm is executed for n iterations, the next iteration starts from the situation at the end of the previous one).

A possible algorithm in your case would be:

. from a list of boxes, find the closest box to each attractor point
. subdivide only the closest box
. pass to the next iterations the subdivided boxes

Repeat the above n times (as many as you need). Since Grasshopper does not implement iterative processes natively, you’ll either need a plugin like Anemone or code it yourself in a custom C# or Python scripting component.

I’ve made a possible example using Anemone. For Octree subdivisions, I prefer a non-distructive method. The algorithm works for any number of points, in any position.

Octree Attractors.gh (23.8 KB)


Certainly with scripting it can be more elegant, but it can also be done simply like this:
octree_example.gh (15.6 KB)


i had a look at your code. what do the c# + mass addition components do?

The C# component contains the single line box.Contains(point), to check if the box contains the point.
You could also use the standard PointInBrep component in place of this and the result will be identical, but it is much slower.

The mass addition component takes the list of booleans for whether each of the input points is contained in the box and adds them together. So if the box contains none of the points, the result will be zero, but if it contains one or more, the result will be a positive value (which gets interpreted as True when passed to the boolean input of the next part).

1 Like

Hello, I misspoke, I would like to divide cubes, not surfaces. The idea is to have cubes that divide into several smaller cubes using attractor points.

from Mesh Plus.gh (15.2 KB)
Oh, you said cubes, then this solution is not rightHoneycam 2024-06-06 19-48-05


oh, ok. i had tried this.
subdivide box faces.gh (18.3 KB)

i think it might be interesting for other uses, maybe for facade studies?
anyway i think the guys above gave you the solution

1 Like

Thank you very much! This is exactly what I was looking to do. I will try it.

1 Like

oh, wow! thank you!
just to ask, I’d like to start using some scripting to do things maybe complicated with traditional components… But I’ve never used it.
Do you have any tips to get me started? C#? VB Script?

Thank you all! I am impressed by your responsiveness and your level of expertise.