# Subdividing a cuboid into individual cuboids

Hi all,

Is there a way to subdivide a cuboid into multiple cuboids (eg 3x3x3 into 27 1x1x1 cube just like a rubik’s cube but not necessarily have equal sides, can be 3x3x4, etc)…

I have done this only in 2d where a surface is subdivided into square panels…

Thanks in advance for your help - I am very new to Dynamo geometry…

After you divide surface in 2d you can use surface.thickness node or Curve.Exrtrude node to get solids from it.

Hi @Kulkul, thank you! I will try that (don’t have my pc atm)

Hi Kulkul,

Using the Surface.Thickness just created one solid surface without subdivisions… Curve.Extrude doesn’t work for some reason…

@archjahzzy Could you please show us your complete graph with all the previews visible.

Hi!

I have generated a solid mass with movable spherical voids to create different form options…
However, I need to further refine this by subdividing the solid into cubes with LxWxH that can be varied, too. And all cubes that intersect by more than 50% with the spherical void will be deleted…

Thank you!

Hi @Kulkul, this is the graph… sorry, later I will turn on all previews… I am out having lunch. Thanks!

Hi @Kulkul,

This is how I ma

de the surface with panels -

It works as expected:

Ohhh… I seee! I used Curved.Extrude instead of Curve.ExtrudeAsSolid

So… now, just another thing. Instead of one single cuboid along the z axis, I want it to be a series of cubes such that they are divided into my panel size… However, using the range values as input to the distance gives me an error…

@archjahzzy What does the error says?

Hi @Kulkul,

I managed to do that with the voids excluded, too. Thank you so much!

To further explain my previous question… here is the outcome of the original extrusion with a single z-value:

But I want to add grids so that these cuboids will be further subdivided into small cubes… I thought I could do it by using 0…1…#1.2 as codeblock range value but it gives me error…

Am I using the wrong node or writing the wrong code?

Thanks

here it is… thanks!

Actual_v2.dyn (921.2 KB)

@archjahzzy Is this what your looking for?

Hi, I think the concept is the same…

But I’m thinking of using the 2 spheres along the longer sides as attractor objects (points used will have x&y value equal to spheres’ midpoints but z value will be equal to the spheres’ radii)

I still need to figure it out… But thanks anyways. I will create another post for attractor points if I can’t find any helpful posts…

@archjahzzy Don’t forget to mark this post as solved. You’re welcome!

I’ve also done something similar by building the individual cubes. They have to be fairly regular this way but it still works.