Output variable information from Customized Goal Object

Hi, I’m trying to define some customize goal object for the Kangaroo solver.

Considering the Caculate method, is there some way to Print out variable information to the output?

 public override void Calculate(List<KangarooSolver.Particle> p)
      for (int i = 0; i < PIndex.Length; i++)
        Point3d ThisPt = p[PIndex[i]].Position;
        double t = new double();
        _curve.ClosestPoint(ThisPt, out t);

        Vector3d refDir = rV[i] - ThisPt;
        Vector3d cDir = _curve.PointAt(t) - ThisPt;

        Move[i] = cDir;
        Weighting[i] = Strength;

        **Print(Vector3d.Multiply(refDir, cDir).ToString());**

        if (Vector3d.Multiply(refDir, cDir) <= 0)
          Weighting[i] = Strength * 1;


Something like the Print line above. (sorry hightight here doesn’t work)
The current c# component reports: Cannot access a non-static member of outer type 'Script_Instance' via nested type 'script_Instance.OnCurveMod'

There is an Output method you can override similar to the Calculate one, and the result comes out of the solver output. For example, see how the spring here outputs a line.

Thanks for the quick reply!
It works!

1 Like

Hi Daniel,

Is it possible to return a list of items?
If I use List, Kangaroo will complain:

Which cannot be shown directly in Rhino.