Kangaroo

THIS FORUM IS NO LONGER ACTIVE. PLEASE POST ANY NEW QUESTIONS OR DISCUSSION ON:

https://discourse.mcneel.com/c/grasshopper/kangaroo

The discussions here are preserved for reference, but new questions posted here are likely to go unanswered.

Kangaroo is a Live Physics engine for interactive simulation, optimization and form-finding directly within Grasshopper.

Kangaroo 2 scripting

Hi Daniel and hi all,

Short question, debugging issues. I'm modifying a c# custom goal scripting example. I've been writing some lines but I'm completely blind.

Inside the custom goal, inside public override void Calculate(List<KangarooSolver.Particle> p), is there any way of outputing other geometry (such as vectors or lines, to see what is happening) or using the Print() command? (I've been getting errors when trying it)
Thanks a lot!
  • up

    Daniel Piker

    There is another method called Output which you can add to your custom GoalObject implementation.

    So for instance, with a length goal, you might want to output the actual line updated with the new end point positions, for which you would add something like this:

    public new object Output(List<KangarooSolver.Particle> p)
    {
    Line L = new Line(p[PIndex[0]].Position, p[PIndex[1]].Position);
    return L;
    }

    All of these outputs come out of the O parameter of the solver component.

    2