# KANGAROO2 Circle Packing - Different sized circles

http://hydra.nat.uni-magdeburg.de/packing/

Hi Daniel,
Thanks for your sharing. Base on your gh file, I wonder if we can add 2D close curve acts like a “vaccum bag” to achieve a minimal 2D bounday for the circles (see my hand sketch)?

Thanks for any suggestion!

circlenestpuzzle.3dm (31.5 KB) circlenestpuzzle.gh (37.9 KB)

Here’s one tensioning a cable around the outside
wrapcircles.gh (16.6 KB)

This way the boundary will form a convex hull of the circles - if you want the boundary to also pull into the concave parts then you’ll need a version with 2d pressure.

11 Likes

There was a component called AlphaShape which would allow the concave boundary between shapes like a vacuum form but I can’t find it on Food4Rhino…

Also, I can’t get it to work on R7

It is out there on this forum if you search alpha shape…

Alpha Shapes 2D

https://discourse.mcneel.com/t/alpha-shape-3d/60651

ah… it was on the Milkbox group on the old forum and by @MateuszZwierzycki I think

Here’s a version using 2d pressure to do a vacuum form which pulls the circles together

wrapcircles2.gh (23.2 KB)

21 Likes

Great, thanks Daniel!!

I have done a minor change to the GH, I want to predefine the circle radius and add a grab force to it. But don’t know why the whole bag tend to ‘flow’ to the y axis direction…How can I keep my bag not to flow to one direction, so I can manually adjust the circles and bag’s shape and location?

wrapcircles3.gh (21.1 KB)

It looks like this drifting issue is caused by something unbalanced in the Area goal.
Here’s a version that uses a simpler 2d pressure to avoid this.
There can still be small amount of drift from the collisions too, so I’ve also added a weak PlasticAnchor (which acts as a sort of static friction).

wrapcircles4.gh (26.5 KB)

13 Likes

Thanks Daniel, but for some reason I cannot get your script running…
Do I need to install any plug-ins?
When open your file, it shows this

You need to tell it where your copy of KangarooSolver.dll is installed.
Either when the error pops up on opening, or by right clicking the red script component and selecting Manage Assemblies.

This file is part of Rhino, and if you have multiple versions of Rhino installed, you need to reference the one from the version you are currently running.

I think this will usually be one of these directories:

`C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Components`

`C:\Program Files\Rhino WIP\Plug-ins\Grasshopper\Components`
(if you first installed v7 when it was a WIP)

`C:\Program Files\Rhino 7\Plug-ins\Grasshopper\Components`

`C:\Program Files\Rhino 8 WIP\Plug-ins\Grasshopper\Components`

1 Like

Thanks, problem solved

1 Like

Thanks Daniel for the impressive circle packing2
as Grasshopper newbie I’m having the same assembly reference issue in Rhino7 for Mac,
do you have a suggestion to run wrapcircles4?

Hi @dynmx,
Thanks - see the answer here on setting the reference assembly location on Mac:

top! works :-)>

1 Like

Hi folks,
Thanks this very usefull thread, I played with these definitions but always noticed there’s a C# component that make me feel like the last of the classroom…wait this remember something.
When it’s about packing like above examples is it the only way to do it?As I know nothing about C# this is a kind of prohibition for me, should I copy paste my schoolmate work, again?..

Circle packing is one of the most-used kangaroo applications, maybe it should become a stand-alone rhino command.