Circle packing with fixed radius and fixed number of circle for each radius

Forgot to mention - When making this I noticed a small error causing an instability in the collisions component, so the definition above includes a scripted fix for this. When you first open it, you’ll be prompted to set the location of the referenced file and will need to tell it where your copy of KangarooSolver.dll is.

4 Likes

I’d missed that post - nice work!

As always wonderful results @DanielPiker. And thanks for all the good examples. I use also a lot MeshMachineStatic.
I had just some difficulties finding the location of solver on my PC with Rhino 6.0
C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Components

circles_in_circle5sizes.gh (28.6 KB)

Here’s a version showing how you can have more different sizes.
I think it would be a pretty hard problem to find a global optimum for (in terms of minimum radii for the outer circle for a given set of circles inside), but I noticed you can often improve the packing by shrinking down the outer radius to give them a squeeze so they all overlap slightly, then bring it back up to a point where they are tangent again.
I found it interesting how if you keep doing this, it tends to push the smaller circles towards the middle.

14 Likes

That’s insane! Guys thank you so much. @DanielPiker your script is perfect. I am extremely grateful for your help and your time.

I was playing around with this yesterday but didn’t get it to work satisfactorily - definitely @DanielPiker’s version is much better!

In case anyone’s interested though: circle-in-circle-packing.gh (22.2 KB)
( requires quite a lot of manual tweaking and dragging points about… really should get around to learning custom Kangaroo goal scripting :sweat_smile: )

3 Likes

Thanks for sharing - I prefer this way of controlling the numbers and radii.
By the way - the problem I found with the collisions component was that when one object was involved in multiple collisions, the vectors were being summed, but to keep it stable in the new solver what really needed to happen was for these vectors to be averaged.

With a few small changes it was possible to use this to simulate granular convection, sometimes called the ‘Brazil nut effect’ - the tendency of larger particles to rise to the top when their container is shaken, such as Brazil nuts in a box of muesli!

brazilnut.gh (30.2 KB)

30 Likes

Great work.
Interestingly enough, this shaking principle is the operational principle for an ultrasonic particle sorter, used to sort very fine grades of abrasives (in the 600 to 50,000 mesh range), pharmaceutical particles,
Which leads to the thought, this could be used to study soil liquification during disturbance events, for example a seismic event. The vertical load (y) in your script could be reduced by effective buoyancy due to ground water, particle to particle cohesion could be modeled, containment pressure could also be added.
Great work.

Hello
Amazing! do you need kanagaroo2 plugins to complete the script?

Yes, you’ll need a current version of kangaroo to run this definition. Rhino 6 includes this, or if on rhino 5 you can get the latest from food4rhino

Very interested to take a look at this, but I get the following error message:

Error (CS0246): The type or namespace name ‘GoalObject’ could not be found (are you missing a using directive or an assembly reference?) (line 79)

I changed the assembly reference location for the KangarooSolver.dll, and made sure it was unblocked.

Any ideas?

Rhino Version 6 SR7

Because you’re using Rhino 6, make sure to reference the copy of the DLL in the Rhino folder (Program Files>Rhino6>Plug-ins>Grasshopper>Components), not the one in the roaming grasshopper libraries folder.

That solved it. Thanks.


I am having this issue at the moment, i have relinked the KangarooSolver but this still comes up. I am still getting to know Grasshopper altogether forgive me !

It looks like the main Kangaroo solver component isn’t loading.
This is usually due to a blocked dll.
I presume you’re on Rhino 5?
Go into the directory where you installed Kangaroo, and for both the dll and gha, right click, select properties and unblock. Then restart Rhino and it should work.

Thank you very much thats working now! i got the current version of kangaroo as suggested.

@DanielPiker this might be a redundant question but how exactly do I change the assembly reference?

Rhino 5 for Mac with latest GH

Thanks!

1 Like

Hello again, do you have an image of this script? struggling to make connections for missing plugins even though i have downloaded them

Hi!
Is there an option to put this circles of fixed radius at defined surface? I want to make something like this:

I’d be very grateful for any help or tips

1 Like