Kangaroo attraction and repulsion forces

Hello everyone,
I used attraction force to make minimal paths that pass though 3 buildings on the ground level. But I failed to combine with repulsion force to make the paths detour from the elevators and staircases in the cores of the buildings. Can somebody help me have a look at the codes to see how to do it please?
Thank you for your help ! :pray:
Wool_Threads_v2.gh (65.3 KB)



Here are some examples with more up to date version of the attraction/repulsion

Thank you for your scripts David :slight_smile: I understood this script less than the old one. I tried to connect the positive points to the points I want attractive force, and connect the negative points to the points I want repulsive force, but it didn’t work. How do I convert the points into minimal paths? Thank you!

Hi @ka.man.lee
Here’s an updated example specifically for the Frei Otto wet threads type form-finding.


woolthreads_k2.gh (13.8 KB)

As for including obstacles which the paths have to go around-
One simple way could be to keep the threads on a surface with holes cut out for the obstacles:


woolthreads_obstacles.gh (16.6 KB)

6 Likes

Hi @DanielPiker
I’m quite new to Kangaroo so apologies if my question has quite an obvious answer or is in the wrong place. I saw your C# script outputs the following string “Script_Instance+RangedAttraction” how does the solver use this string to extract all the relevant information for the goal?
Also I can’t read C#, is it possible to script for kangaroo in Python? If so is there any documentation?
Thanks in advance!

Hi @david.prior-hope17

The script is not outputting a string, but an object. In this case the object is an instance of the ‘RangedAttraction’ class which is defined in the script (and inherits from the GoalObject class defined in KangarooSolver.dll).
When you hover over the output or connect a text panel, Grasshopper converts the object to a string to try and tell you something about the object, but what is really passed between the components is more than just that string - it’s the whole class with its methods and properties, which can then be called by the solver.

Yes, it is possible to script Kangaroo goals with Python. @AndersDeleuran has kindly shared some examples here GitHub - AndersDeleuran/KangarooGHPython: How to stuff a Kangaroo in your Python using a Grasshopper</

I think doing it with C# will probably be a bit easier though, as there will just be a lot more examples to refer to. Normally creating a goal will involve mostly just vector operations, so you won’t need to learn a lot of esoteric language specific things.

1 Like

Very cool! Thanks so much for the prompt response, all makes sense!

1 Like