Creating interactive linkages (linked lines)

I’m trying to find a way of creating a simple model of 4 connected lines (i.e. a quadrilateral) where I can alter the angle of one side and have the other sides adapt – i.e. linkages.

I have several ideas of how to calculate the appropriate corner points in a complicated manner (such as creating two arcs with relevant radii and then finding the intersection) but hoped there was something already available which could do this sort of thing. I have been unsuccessful in even finding a function where a point is positioned at set distances from two reference points.


Here is a simple test with just lines & points. I would add negative ability to the number sliders for the X & Y . There may be a way to adjust the angle between the lines. This is just a starting point.

IHTH «Randy

quadrangel (16.1 KB)

Hi Randy. Thanks for your efforts.

I’ve attached an image to more clearly illustrate what I was after. The lines need to remain constant lengths, so as one angle changes it causes the opposite angle to adjust (and the adjacent angles to adjust in the opposite direction).

In essence, I am after a grasshopper function which calculates the location of a point given its distance from two reference points.

Well one way to do this is to use the intersection of two circles whose radii represent the lengths of your secondary lines, and whose centers are the ends of your primary lines. Attached is a quickie GH definition - done in GH for Windows Rhino but should work on Mac - to give you an idea. The complication is that the circles could intersect in two points, one point or none at all (meaning no valid solution) - depending on the angles and lengths of your initial lines and your secondary ones. The solution here simply takes the point furthest away from the origin of the first two lines. I left the circles visible to see what’s happening.

–Mitch (17.2 KB)


Thank you for providing your solution. It seems you have approached it the way I was reluctant to. I had contemplated the options of intersecting circles or alternatively using maths to solve the two simultaneous equations (and pick one solution). However it seemed so daunting that I hoped for a trivial approach using something already in Grasshopper.

Your efforts have shown me that the solution indeed isn’t a trivial one, although you have included more functionality than I was going to bother with (such as varying the side length).

My original intention was to create a model of an opening roof for our tennis courts (like convertible cars have) as a fun project. But to create all the linkages in that would be overwhelming.

You are looking to do some constraint modeling. My preferred approach for simple assemblies is what @Helvetosaur mentioned. Other than that, you might want to check out @DanielPiker 's Kangaroo and the constraint solving it can do: Available for Win and Mac versions of Grasshopper.

1 Like

This does indeed look like what I was after. Not just specifically for my current project, but just for the fun of creating constraint and physics situations.

When I first followed the link I was a little deterred as I couldn’t justify spending the money required to buy that level of package. Most surprised / impressed to see that it appears to be free. I was imagining $1000-$2000. :scream:

It will take me a while to get to grips with what is possible. After that, the possibilities are endless. :sunglasses:

Just thought I would add a final comment to this. Kangaroo looks to be impressive, but I am having great difficulties in utilising it. While there are numerous example files around, most are for v1 of Kangaroo and v2 has changed dramatically.

Manuals for using v2 seem to be virtually non-existent, so this has been a slow learning process. Making inroads though.

I’m interested in your progress with this issue. I have a concept for a multi-bar linkage and I’m trying to find the best way to design the correct lengths and test for functionality. Kangaroo? maybe Bongo? I was hoping Kangaroo would suffice because, obviously, it’s free and Bongo is not cheap. I’ve looked at it and it is indeed somewhat opaque.

Have you gotten anywhere with your linkage constraint design?

Hi Pete. The short answer to your question is…

…I gave up. Ended up writing a programme to calculate the best layout for my plans and then inputting those details in to Rhino.

A few weeks ago I rekindled my interest in Kangaroo, but not enough to actually figure out how to do anything. All the demo files I tried told me I was missing other plug-ins and it just got all too hard.

Perhaps longer term I will conquer it. Or some helpful documentation will appear from somewhere.

Hi Ray,

Sorry to hear that,
I recently posted some examples of simple linkages in this discussion that hopefully could help:

I’ve also put up a collection of example files on github here:

Those should all work with the most current version of Kangaroo and without dependencies on other plugins(It’s possible I’ve slipped up somewhere though - please let me know if you find ones that don’t work for you), and I’ll be keeping them updated.

Please let me know if there is more I can help with

Hi daniel,

I just updated the Kangaroo plugin and then I found that I have three (3) Solver dll’s. Two in WIP. Isn’t this one too many in the WIP folders, and if so, which one to drop?

// Rolf

Hi Rolf,

Kangaroo(both the dll and gha) should be installed in the folder you get to from the Grasshopper menu >File>Special Folders>Components Folder.
This should be something like C:\Users\Daniel\AppData\Roaming\Grasshopper\Libraries

You can delete all the other copies of those files you have.

If I do so, and keep the WIP files (Kangaroo2Component.gha and KangarooSolver.dll) I get a conflict message each time I start WIP.

If I delete those WIP files, then when I open your (git) example files in WIP, like for example, I get a message that component is missing (I think it is the latest Solver from 2.3.1 that is missing)

The Solver goes red and dead:

// Rolf

I tried to restore WIP’s Kangaroo2Component.gha and KnagarooSolver.dll but it seem I cannot run the examples on any version of Rhino. I installed the last 2.3.1 version on Rhino5, but I don’t know how to do the same in WIP as to make it work.

So now I wonder if the problem is in the example or in my configuration(s)? No combination seems to work)

// Rolf

Hi Rolf,

Thank you for your patience sticking with this!

The gha and dll to use are the ones from Food4Rhino - 2.3.1 is more recent than the one included in the WIP.
So the files should be called just Kangaroo2.gha and KangarooSolver.dll, and when you hover over the dll in file explorer it should show version

However it seems there is also another issue - I appear to have still left some Kangaroo1 components in some examples, sorry. I’ve just committed a fix to the example, but am going to go through the others systematically now to make sure.

That’s OK. I have now cleaned it all up and installed only 2.3.1 in the Components folder and I’ll await your update of the examples, no problem.

// Rolf