# Kangaroo problem with solver

**URL:** <https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248>\
**Category:** Grasshopper\
**Tags:** windows, kangaroo, rhino7\
**Created:** [July 11, 2021, 3:31am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248 "2021-07-11T03:31:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 3:31am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/1 "2021-07-11T03:31:40Z")

</div>

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.

> [@Create springs in Kangaroo 2](https://discourse.mcneel.com/t/create-springs-in-kangaroo-2/89126/2):
>
> I think this is not exactly what you want, anyway have a look… [Kangaroo2\_springs\_re.gh](https://discourse.mcneel.com/uploads/short-url/9NkdFItu13ahRoxF3nIW2CnyoJ3.gh) (12.3 KB)

 ![error](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/f/4/cf4a3f0b1d98c733551d13f625051b806170be27.png)

[kangaroo.gh](https://discourse.mcneel.com/uploads/short-url/pxUQ0yN9xFQvhrRpBTiB9sWkTAR.gh) (14.1 KB)

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [July 11, 2021, 5:42am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/2 "2021-07-11T05:42:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 5:52am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/3 "2021-07-11T05:52:00Z")

</div>

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

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/5/2/f52baeabf63f4fa81881a66ce8cbdd04dcc4e218.png)

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [July 11, 2021, 6:04am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/4 "2021-07-11T06:04:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 6:35am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/5 "2021-07-11T06:35:58Z")

</div>

You can check the file attached

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 6:37am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/6 "2021-07-11T06:37:37Z")

</div>

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

```auto
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()

```

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [July 11, 2021, 6:52am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/7 "2021-07-11T06:52:27Z")

</div>

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

This works for me:

 ![Screenshot 2021-07-11 at 08.47.32](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/f/c/ffcdac948143fa83fe1e3c84902a9dda4e122865.png)

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.

> [@anon39580149](#):
>
> How i can use Grab in Python script?

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

---

<div class="post-metadata">

**Author:** ![DanielPiker](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/danielpiker/32/666337_2.png) [@DanielPiker](https://discourse.mcneel.com/u/DanielPiker)\
**Post date:** [July 11, 2021, 11:48am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/8 "2021-07-11T11:48:38Z")

</div>

Hi @anon39580149,

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

```auto
    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?

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 11:53am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/9 "2021-07-11T11:53:00Z")

</div>

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

> [@Slider in Rhino window , possible?](https://discourse.mcneel.com/t/slider-in-rhino-window-possible/127197/9):
>
> Test

---

<div class="post-metadata">

**Author:** ![DanielPiker](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/danielpiker/32/666337_2.png) [@DanielPiker](https://discourse.mcneel.com/u/DanielPiker)\
**Post date:** [July 11, 2021, 11:59am UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/10 "2021-07-11T11:59:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 12:03pm UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/11 "2021-07-11T12:03:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DanielPiker](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/danielpiker/32/666337_2.png) [@DanielPiker](https://discourse.mcneel.com/u/DanielPiker)\
**Post date:** [July 11, 2021, 12:10pm UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/12 "2021-07-11T12:10:13Z")

</div>

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](https://discourse.mcneel.com/uploads/short-url/tU8F88l8FWmZEoSpFJ0tt8tUmFP.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.

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [July 11, 2021, 3:55pm UTC](https://discourse.mcneel.com/t/kangaroo-problem-with-solver/127248/13 "2021-07-11T15:55:55Z")

</div>

I understand  
Thank you very much @DanielPiker
