Using Grasshopper to calculate the incline of curving ramps in Rhino

Friday 19th February § 40 Comments

If the title is completely baffling, then the rest of this post probably won’t mean much either. Rhino is my preferred NURBS based 3D software, and Grasshopper is a plugin that generates shapes using a logic built up using a flow chart type graph. I’ve been learning Grasshopper as part of my current project, and finding it really valuable in moderation. It can do things that

The way I like to think of Grasshopper as a box of tools that you can use in certain situations, and you can make your own sophisticated tool out of primitive building blocks. It’s nice to open a Grasshopper file, apply a transformation or calculate a geometry, and then get your results back into the familiar world of curves, lines and surfaces as soon as possible. It’s particularly good if your tool does something generic enough that it can be re-used again and again in different projects.

Anyone who know’s my work can verify that I use curves everywhere in my designs. It so ingrained into my designs that it feels unnatural when I constrain myself to straight lines. In my latest project (which I’ve been working on for over a year now!) I’ve been taking this to the extreme. There isn’t a straight path in the whole scheme. My response to the site also leads to a requirement for a series of changes in level. Exterior changes in levels and curving inevitably means curving ramps. If you’ve ever tried to do this accurately in Rhino you’ll know that this can be a real pain. I spent far too long starting out with a straight ramp curve and trying to Bend it into the shape that I wanted. Time I could have spent more productively elsewhere if only I’d spent the small upfront time to work this out earlier.

My simple Grasshopper definition takes a flat curve (planar in the z axis) and from it, generates a curve that will follow the same in plan, but in profile rises along the length of the input curve at an incline that you set.

First, download the Grasshopper definition ➞ Curving Ramp.ghx.zip. It should look something like this:

Grasshopper

Once you’ve opened the file in Grasshopper you need to select the input curve:

Selecting the source curve

Adjust the ramp gradient as required:

Set the gradient

And then finally ‘Bake’ the resulting curve:

Bake the resulting curve

‘Baking’ is the way that you get your results out of Grasshopper. Think of it as a short way of saying: ‘Take a snapshot of this object as I see it now and translate it into standard Rhino objects of points, curves and surfaces’.

Ramp

In this example the blue curve at the bottom is the source, and the purple curve is the result that’s been baked from Grasshopper, combined with a simple Sweep1 along the resulting baked curve to create a ramp that has a reasonably uniform incline.

For the true perfectionist (like me), you can apply the process to two curves, one offset from the other, and then do a Sweep2 between them. Doing it this way avoids the slight variance in incline when sweeping around a tight corner and is more perfectly uniform.

If the resulting ramp is facing the wrong way then you can flip the source curve using Rhino’s Flip command and it should then rise in the correct direction. Also, if your in architecture yourself, then be sure to check that the ramps length complies with the building regulations of your country.

Wheww, that’s quite a lot of words to describe something thats not hard to use. And this is supposed to be my non-geeky blog! I hope that a very specialist subset of you find this helpful. I also hope it’ll help people get over their fear of Grasshopper.. and of curves.

Curves are good. Embrace the curve!

Advertisements

§ 40 Responses to Using Grasshopper to calculate the incline of curving ramps in Rhino

  • Julio says:

    I cheked the link of the ghx file, but it comes up with a page full of script, not sure what to do with that???

    • Harry says:

      Hi Julio,
      Sorry I’ve left this for so long. I wrapped the ghx file in a .zip archive, which most browsers should download automatically. If you still have trouble then you can right click on the link, and depending on your system there should be a menu equivalent to ‘Save as’ or ‘Download’ which will allow you to save the file to the filesystem, rather than opening it in the browser.

  • Brett says:

    Ah, thank you so much for having this tutorial. Unfortunately it looks like the Grasshopper definition is no longer in existence. Would it be possible to resolve that so I can finally get a proper curving ramp???

    Thanks muchly,
    Brett

    • claudia says:

      bummer! i was so psyched to finally figure out how to slope my curved ramp, but i can’t seem to find the definition. if you would republish i would be most appreciative. at the moment i’m “rotating 3d” the various pieces. ugh!!!

  • claudia says:

    harry, you are a genius. baked the curve (first time using grasshopper) and my ramp curve is a thing of beauty! only problem, i can’t select the curve in rhino. it’s there, it’s not locked but its a different color than any of my layers and cannot be selected. i’m checking grasshopper sites too for answers but figured i’d ask you since you were so helpful and quick to reply already. thanks again!

  • claudia says:

    never mind. i got it. thank you soooo much!

  • Clancy White says:

    Thanks! Its such a usefule script! We noticed the bottom of the ramp starts at +1 but seems to be fixable by doing the following

    Dim heightBetweenPoints As Double = Height / numberOfPoints

    to

    to Dim heightBetweenPoints As Double = Height / (numberOfPoints – 1)

    and

    newPoint.z = existingPoint.z + (heightBetweenPoints * (index + 1))

    to

    newPoint.z = existingPoint.z + (heightBetweenPoints * index)

  • xxxxx says:

    Thanks for this file Harry.. but I didn’t get it..If I set the first slider with the number 8… does it mean the ramp will have 8% of inclination?

    I’m trying to build a curved ramp with 8% inclination… and another one with 20%

    Could you please answer if i get it right? And if not, how can I make it using this definition?

    Thanks.

    Victor

    • Harry says:

      Hi Victor,
      The input is the denominator of the ratio of the ramp.. So for a ramp of 1:20 you’d enter 20. Too create an 8% incline you’d use a value of 12.5 (100 / 8), and for 20% it would be 5. It’s only guess what your doing, but 1 in 5 sounds rather steep for an architectural ramp, at least if your intending it to be wheelchair accessible. Hope this helps.
      Harry

      • xxxxx says:

        Thanks Harry, i got it now. The one with 20% i’m going to use for a car ramp.
        Your definition is awesome. Now I can generate some crazy ramps. =D

  • Harrison says:

    Excellent plug in. Thank You!

  • Mike says:

    Brilliant! Thanks for this!

  • victoria says:

    Thank you SO much! It’s so helpful to have this as I’m learning Grasshopper.

  • Katie says:

    This is wonderful! Thank you so much.

  • Maximo says:

    Hi,
    I wanted to know if there was a way to make a ramp inside a vortex like form, circular one.
    Thanks

    • Harry says:

      It’m sure it’s possible but I’m not sure how. This script might serve as a starting point.. but my guess is that it would get quite complicated to be accurate (genetic algorithms would be my hunch).. This is probably too late for you anyway but my inclination would be to fake it using a plain spiral like a vertical coil, and then just trim that to the edge of the vortex.

  • Elen says:

    Hello,

    This is exactly what I need at the moment, but it seems that the file was moved from your server. Do you mind e-mailing a copy?

  • ellipo says:

    Hey! I would love to take a look at your grasshopper file but the link doesn’t seem to be working any more …. Would you mind sending it to me or re-linking the file?

    Thanks!!

  • Harry says:

    @ellen, @ellipo Hopefully the links should work again.. hope it’s of use

  • J says:

    Hi,

    Thank you for posting this! I just tried to apply the formula in grasshopper to a curve I had already constructed in Rhino and cannot get it to work. I know I want the slope to be 2.5% so I have made the slider 40, but it doesn’t seem to be sloping. Any ideas of what is going on? My curve is over 1,000 feet – not sure if the length is affecting it?

    Thanks!

    • Harry says:

      Hi J,
      The length shouldn’t be a problem. I’m not sure what to suggest. Is the curve is flattened before you begin?

      • Jennifer Ingram says:

        I think it is flattened? It is actually offset 20′ from itself to make a surface, so I think it is flattened since I was able to create a surface from the curves.

        I imported the definition into Grasshopper and then linked the curve i had drawn in Rhino to the crv definition.
        When I moved the slider, it did not change.

      • J says:

        Can I use the definition downloaded from this site or do I need to recreate it? Is it because some of them have OLD written on them? Also, the IntCrv has an error message “Insufficient vertices for a curve”?

      • Harry says:

        Hi Jennifer,
        I.. don’t know. I’ve only got Rhino 4 so the OLD labels might have something to do with that. I don’t know how much has changed. You could try increasing the number of divisions (set by the slider that leads to the divide module), but ultimately yes recreating it in Rhino/Grasshopper 5 might be the best solution. Let me know if you do update it and I’ll add a link. Sorry I can’t be more helpful
        Harry

  • Jennifer Ingram says:

    Thank you!

  • Hello the definition file does not appear to be available on the server anymore. Is it possible to repost? Thanks very much!

  • dale says:

    Is there any way you could repost the definition? I cannot figure out out to model a curved ramp in Rhino for the life of me! Your help is greatly appreciated!!

  • pde13 says:

    could you please repost? the link is down

  • cem açıkada says:

    hi, it seems to be a good solution. please update the link.
    it is not serving any more.

  • Taylor says:

    This script looks amazing but I cannot get it to download

  • Harry says:

    I’m sorry I’ve been so slow fixing this. I’ve been out of the country for a while. It should work now. Be aware, it was created with Rhino 4 and an older version of Grasshopper and I’ve heard it has a few warnings in the new version.
    Hopefully it should still work for you.

  • In recent years, there’s a wide range of rubbish within the online world, is
    incredible to see that you may still find useful sites out there.

  • For newer grasshopper users, does anyone know what widget can replace the old ‘F2(Fx,y)’ and the old ‘Interpolate Curve’ widget?

    I would love to use this definition as I am creating curving ramps but I am new to grasshopper and cant figure out how to adjust the definition to suit the newer version of grasshopper/rhino.

    Thanks!!

  • Roxi says:

    Hi! What should I do if I want to change the ramp direction? I want it to grow from the right to left, not from the left to right…I hope you understant what I’m asking…

    • Harry says:

      I don’t have Rhino to hand but I seem to remember there being an Invert action or something similarly named, maybe Flip Curve? It’s in there somewhere

      I also have a vague recollection of a mode which enabled arrows showing the curves direction

      Hope that helps

      Harry

    • Roxi says:

      I made it! Sorry for the useless post 😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Using Grasshopper to calculate the incline of curving ramps in Rhino at Anti-Kitsch.

meta