3D Grid with "cubes" position possibilities

Hello everyone, good evening, how are you?

I was wondering if anyone culd help me with Rhino/Grasshopper. I’m not sure how to solve the following situation:

I have this 3D grid with a pre-established size.
Within this grid, there are some volumetric spaces shaped like cubes.
What I need to do is study some possible randomized combinations for these cubes.
These cubes need to have the dimensions that are defined according to the grid.
Do you think this would be possible? The problem is that these cubes always need to fill all the space where they were originally placed.

It’s as if I had a large cube that is sectioned by this grid. Then, the cubes left over need to be randomized by subtracting some of them, but they need to remain in the same place where they were generated.

Imagine that this large cube formed by the grid is a building, and the smaller cubes cut by the grid are rooms or spaces.
I would need to create several possible combinations of filled and empty spaces, but the rooms need to stay in their original locations.

Any ideas?
Thanks very much for yout help guys!

Post some code or files or something.

1 Like

This model is actually in SketchUp. Would it help if I modeled it in Rhino for you to take a look?

Hello
I don’t really understand what are the rules to keep or remove a cube. But if you want a totally random configuration, it is quite easy to do it with Grasshopper.
Lets say you have 100 “volume”, you generate 100 random double in [0 1] range. Then you select the number that are greater or less that a value between 0 and 1.



cull shapes randomly.gh (11.3 KB)

Hi Laurent! Thank you very much for your attention and help!

There would be two different approaches: The first would be exactly as you did, with a completely random combination. And the other approach would be to have a rule where one of the cubes must always be in contact with another. A cube could never be completely isolated.

The issue is that these ‘cubes’ would need to have specific measurements. I modeled these measurements in Rhino so you can have an idea.

Thank you very much for your help, this will help me a lot with this project!
Eminor.3dm (368.4 KB)
Captura de tela 2024-09-24 211503

Hello I don’t like too much your geometry. Let me explain, the job you want to do is a question of topology, for topology you need to have relations between objects. As here your objects are disconnected, a tool need to be done to find the good relation you need. You said in contact but not all your geometry are in contact !
For this job I imagine you mean face faces each other.
Clash doesn’t work here as it will also gives edges edge proximity, or point proximity.
So here a tool that uses Proximity, but as it is distance based I am not sure it gives 100 % good results with the distance I choose (2.2 )
I made a little tool that take some relations and group the relation. For example if we say
0 is in relation with 1 and 2
1 is in in relation with 2
2 is in in relation with 1
3 is in relation with 4
and 4 is in relation with 3
it means there are 2 groups (0, 1, 2) and (3, 4)



topology of face face proximity.gh (482.6 KB)

Quick solution that doesn’t give you many options as far as precise control over number of rooms.


boxes.gh (214.9 KB)

1 Like

Very nice way of doing, just some times box face are not touching. Perhaps could be improved by choosing just curves on X, Y or Z

A bit complex here, but
first step is generate orthogonal curves
choose randomly some of them
take the biggest group of connected curves (it uses Nautilus plugin tool to group topology informations)
then use your way of doing to find collision but as there are more than one curves I added some components



cull shapes randomly with curves.gh (238.8 KB)

1 Like

Hi Laurent! I’m sorry to hear that, but it’s not a geometry I chose arbitrarily. It’s part of a creative and constructive process methodology that connects music with architecture.
It’s very important for my research, so I’m very grateful to all of you! It’s amazing.

Hi Ftzuk! Wow, that’s amazing, it’s exactly the kind of study I need to continue my research! Thank you so much.
Sorry for the mistake where the faces aren’t correctly touching each other.
This will already be very helpful for my research.
I would like to understand how you achieved this result.
If I wanted to start from another grid with different measurements, or if it were two modules of this grid so it would be larger on the X axis and smaller on the Y axis, could you explain how I would reach the result you achieved?
I’m a beginner in Grasshopper; for architecture, I use other software, but the possibilities with Grasshopper are incredible.
Sorry for asking so many favors, but you have no idea how important this is for me. Thank you so much for all your help!

I suggest looking at the code I posted - it’s quite self-explanatory. The bounding box means that whatever grid size you use the script will work.

It’s just creating random points inside that bounding box, creating a curve through all those points and keeping your grid blocks that intersect with that curve. Not a lot of control and it would be worth digging into @laurent_delrieu solution if you need more control and ensure that box faces are always touching.

I just meant that as it is just geometry relations have to be rebuild. If geometry was done in Grasshopper it could be more simple to track relation between shapes. A shape could tagged [1, 2, 3] 1 is the index along X, 2 along Y and 3 along Z. So it is easy to know that [1, 2, 4] is above …

It is not an aesthetic judgement.

Hi everyone! Sorry for the delay in responding; I had my thesis presentation these past few days and had to focus on that.

Thank you very much for your help, Ftzuk!
Sorry for my amateur skills in Grasshopper. I didn’t quite understand at which point in the process you selected the Rhino geometric shape so that Grasshopper could modify it.
Could you please explain it to me?
And would you mind sharing the code for that last image you made?
I really really appreciate your help!!

Hum I see Laurent!
I will try to remake this shape but directly in grasshopper. Thank very much for your help!
You have no idea how your help is bein extremely important at this moment. Thank you very much!!

This sounds like it would be possible with https://monoceros.sub.digital/ the Monoceros plugin. It has Wave Function Collapse, which lets you define all these rules and then tries to find a solution.

It’s also on food4rhino here: Monoceros | Food4Rhino

The code is exactly the same as posted previously. I’d suggest doing a few basic grasshopper tutorials. Then plug a panel into every node and see what the output is.

1.)You can see the first node contains BREPS so that’s where the Rhino geometry was referenced in.
2.) Bounding box creates a single box.
3.) Populate 3d fills that box with points.
Etc…

Just follow the flow of information - grasshopper scripts all follow a logical path.