Does kangaroo work with trees?

Hey all,

Short question about Kangaroo 2: can the solver output more than one result by using a tree structured input for the goals? (having say 10 branches with 10 separate sets of goals)

Thank You!

No, the solver integrates all branches into a single, unified simulation. You’d have to run parallel solvers.

Actually to clarify a bit - if your input goals have a tree structure, they all get combined into a single simulation, but the output data will still be structured as the input was.
If the parts of your simulation you want to keep separate are separate in space, this should still allow you to treat them as independent.
Another way that actually does run separate simulations per branch is shown in this scripted example:


uuuh, cool stuff, thanks!
may i ask why doesn’t the official solver work like this?
also, is it my impression or does the zombie kangaroo work a lot faster than the normal one?

Many thanks!

1 Like

Thanks for the example! I had always assumed each branch was a separate solution OOTB

+1 for adding this to the official solver, or adding another solver option in the OOTB implementation.

Dear all,
I’m also trying to have the solvers to output a tree. However, I’m stuck on this:

  • Bouncy solver and zombie solver are working but flatten the output;
  • Normal solver is not working, with the following error: 1. Solution exception:Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.

I’m attaching an image instead of the GH definition since it is a shamefully large one, but I’ll gladly try to simplify it if it helps the discussion:

For now my questions are:

  • Is there a typical case in which all but the normal solver work?
  • Is the normal solver supposed to be the only one that outputs trees?

Thanks in advance!

I think the problem here is caused by connecting the same set of goals to multiple solvers.
The indexing process actually changes the data inside the goal components - breaking the normal rules of Grasshopper against upstream data flow. Therefore if they have already been indexed by one solver instance, it can cause problems when the same goals are connected to a different solver.
Disabling or disconnecting all but one of the solvers on the canvas and pressing reset should resolve the error.

Yes- you are correct that the normal solver is still the only one that outputs trees.
If you need the tree output from the other solvers, you can use the UnFlatten tree component.

Thanks Daniel for the prompt reply!
Relative to the solver error, I found the bug - I had a Show goal attached returning null :stuck_out_tongue:
And Unflatten Tree on zombie solver works perfectly!
Thanks - for the tip and for Kangaroo

1 Like

Hi, Daniel, I’m trying to use your c# script, and I am getting this error:

  1. Unable to cast object of type ‘KangarooSolver.Goals.RigidMesh’ to type ‘KangarooSolver.IGoal’. (line: 78)

Line 78 is the foreach statement.

Any ideas?

Thank you!

1 Like

Hi @claressa
You need to set the assembly reference location of the script component, as described here: