algorithmic modeling for Rhino
In this post Daniel Piker describes how to do custom iteration in Kangaroo with scripting. My C# skills aren't great, and after researching how to translate his scripts to Python, I decided it wouldn't be worth the effort. What I really wanted was a way to do the same thing without scripting.
After two days of experimenting, I finally got some results! I was able to recreate Piker's "growing line" script at the above post by putting the Kangaroo Solver inside an Anemone loop. During each iteration the underlying geometry changes, which is something I'd never seen before in a Kangaroo/gh script without writing code. To make it work, the trick is to attach a Boolean list with [True, False] to the Kangaroo Solver's "Reset" input, while keeping the "On" input set to True. That way at each iteration the solver resets itself and starts again with the new geometry provided by that iteration. Then you have to extract only the output from the second iteration to feed back to Anemone.
The only code I wrote was about 7 lines of Python to split line segments that get too long. That could have been done with only Grasshopper components, but doing it in Python was just too easy.
Brilliant. Thank you for sharing the method.
Very nice David, cool trick, thanks for sharing.
Really nice, love to see Anemone used with Kangaroo...
My setup from years ago https://www.youtube.com/watch?v=MuHlng40kdE was using some more complex boolean switches, where every second Anemone iteration was resetting the Kangaroo solver.. as far as I remember the first Kangaroo didn't keep track of the goals as well as the K2 does.
Here's a slightly simplified version of the same script.
Same idea, with a growing disk.
Thanks for the scripts ! i was trying to plug in anemone to kangaroo fro the above .. and i was clueless. Recursive with kangaroo. plathora of possibilities. Really cool work man !
One tip on your use of Plankton... Instead of hardcoding the full path to the Plankton assemblies as it is on your machine, if you use something like the following then it will work out of the box on other machines :)
import Grasshopper as gh
clr.AddReferenceToFileAndPath(gh.Folders.DefaultAssemblyFolder + "Plankton.gha")
Oops! Thanks for pointing that out, Will. I had figured that out from your "plankton_python_conway" script before I posted the "GrowingSphere" script, but when I made the "GrowingDisk" script I had started with an earlier version.
Attached is an update that others should be able to use as-is (assuming they have Kangaroo and Anemone installed).
Here's the updated script.