Kangaroo problem with solver

Hello @DanielPiker
I test This example of @HS_Kim and it work fine but when i try it in Rhino7 the solver show an error.

kangaroo.gh (14.1 KB)

If I’m not mistaken, you can’t have more than one active Solver treating the same base data concurrently on the canvas. However, you can usually chain them.

I tested before using the example it and got this error , but now it work !
With Zombie solver the error exist.

Oh, the GoalObjects input is also for Kangaroo goals (e.g. edge lengths, anchors, etc.) only. You’re currently inputting some points!

You can check the file attached

How i can use Grab in Python script? and why Goal.Locator don’t accept point?

ps = ks.PhysicalSystem()
goals = List[ks.IGoal]()
pts = List[rg.Point3d]()
pts.Add(point)

wrapper = Grasshopper.Kernel.Types.GH_ObjectWrapper(point)

goals.Add(ks.Goals.OnCurve(pts,curve,100))
goals.Add(ks.Goals.Locator(wrapper))

for g in goals:
    ps.AssignPIndex(g,0.001)

threshold = 1e-20

ps.Step(goals, True, threshold)

point = ps.GetPositions()

Sorry, I mistook the OnCurve for a vanilla component. I’m not used to the icon view. :slight_smile:

This works for me:

I can grab the point and move it along the curve.

As for the second Solver component, read what I’ve written in my first post above.

I don’t know. Sorry. I haven’t used Kangaroo in Python much.

1 Like

Hi @anon39580149,

Passing points should work in a script component if you use CastFrom instead of putting the point in the constructor:

    GH_ObjectWrapper wrapper = new GH_ObjectWrapper();
    wrapper.CastFrom(point);

Using Grab in a script would be more tricky though - it functions a bit differently from the other goals because of the mouse events and dynamic indexing, meaning more of the functionality happens in the component itself. Can you describe a bit about how you want to use it?

1 Like

Thanks @DanielPiker
I want make the definition more simple to use the script many times for different sliders like this:

Does the Grab object have to be created inside the script?
If you’d be okay with connecting the Grab component as an input to the script I think that might be simpler.

Yes i asked to know if it is possible and simple, i will use Grab outside the script ;
also why zombie solver show error?

The Grab component isn’t compatible with the Zombie solver because the Zombie solver does all its iteration to convergence internally in a single SolveInstance, so there’s no time it could accept live updating mouse inputs.

Here’s an example of creating a Grab goal in a script component.
grabscript_test.gh (9.9 KB)

In addition to the reference to KangarooSolverYou’ll need to add one to Kangaroo2Component.gha, because some of the Grab functions are located there.

2 Likes

I understand
Thank you very much @DanielPiker

1 Like