Can input goals depend on solver output?

Dear experts,

I´m trying to model some point mases linked together by an elastic network of springs. The force constant (Strength) of such springs should evolve during the simulation as the point mases positions change.

May Kangaroo input goals change or be updated depending on current output iteration data? For example, would I use as input goals some position dependent forces? If so, how?

Thanks a lot!

Hi @Vigardo

Nearly all the goals do update their action in some way depending on the current state of the system (for instance, the force in a spring depends on how stretched the spring is). I think the only exception would be the load goal, which always applies the same load regardless of the positions of the points.

This kind of looping behaviour is different from the normal order of dependencies when wiring together Grasshopper components though, where cycles are not allowed. So you cannot create new rules for how goals update by wiring components.
You can script custom goals which constantly update their behaviour though.
There are some scripting examples here:


and you can see the code from inside most of the existing built in goals here:

Search this forum for ‘Kangaroo custom goal’ and you’ll find lots more examples I’ve posted on threads here. For instance, here’s a fun one: Create conveyor belt in Kangaroo2
1 Like

Hi Daniel, thanks for the interesting links!

I´m happy to hear that it is possible to update goals modifying your C# scripts, however I feel more comfortable with Python (I have no experience in C#, but I would try if necessary). Fortunately, I´ve found what it seems a Python version of some of your scripting examples.

After taking a look to the StepByStep.py and CustomIteration.py scripts, I think I should be able to update the goals list every iteration.

How would I do this from Python?

Is there any documentation available for Kangaroo2 C# or Python APIs or should I ask more specific questions here?