I want to learn to write my own scripts in grasshopper. Where do I start?

Hi Guys,

I’ve been using Rhino for the past 5 years and it is truly a beautiful program. In the past year, I’ve started to get deep into grasshopper and I feel I’ve started to build some complicated toolchains mainly for automating manual procedures on mesh files.

I’ve been using some scripts I found on this forum to push the limitations of what you can do with existing gh components.

I’d really love to learn to script .gh components to speed up processes and get more value out of grasshopper but I don’t know where to start. I have very limited programming experience from college but I feel that it’s would be best to start fresh.

Any help or resources would be greatly appreciated. Thanks

K

You want to write custom C# scripts, or custom components in C# using Visual Studio (or another ide which compiles C#)?

1 Like

Specifically for C# Grasshopper development, no better place to start than Long’s video series found here: https://developer.rhino3d.com/videos/

Petras also has some great learning resources here: http://petrasvestartas.com/C-for-Grasshopper

Edit: If you want to dip your toe with some GHPython first, you can start with the Grasshopper sections found here: https://developer.rhino3d.com/guides/rhinopython/

6 Likes

This question rise up quite often. Maybe we should create a pinned thread about, like the old forum had.

My personal opinion:
Scripting is fun and there tons of resources out there.There is no right or wrong, all resources out there are valuable and so its only up to your own preference of learning. Just do it, make many errors, understand and learn from them and more important learn to ask the right questions (with google :P).
If you don’t understand or you don’t know how to continue, the only solution is not to stop until you solved the problem. Some “easy” problems took me 1 week to solve. Easy is only easy if you know how to. I wouldn’t say its wasted time, because the only way of learning programming is through errors and persistance.

However it helps if you know your programming language. So if I knew programming before starting programming (sound logical :wink: ), I would have learned about all basics like variables, types, casting, string operations,method/functions and classes at first and in parallel I would have learned about debugging (reading error messages) and how to read an library documentation (sdk documentation).

As a conclusion start with learning the basics about your language, on how to interpret errors,how to work with 3rd party code, and how to ask the right questions.

5 Likes

Hi David,

Thanks for the response. Everything I would be making would be for internal use and may be shared with a handful of people inhouse. So I guess C# is my friend?

Regards,
Kevin

Hi Anders,

Thanks for your reply. I will certainly check out those links. What are the capabilities, limitations of C# vs GHPython ?

Best,
Kevin

Rhino/GHPython implements IronPython, which is written in C#. So they’re kinda the same, in the sense that IronPython is a higher level dynamic version of C#. Functionally speaking I’d recommend GHPython over C# for on-the-fly scripting/coding right on the canvas, and C# for writing compiled code/components in Visual Studio. But again, programming language preference is quite personal and brain dependent. Maybe try both a bit and see what sticks. More to the point though, getting acquainted with the Rhino API (RhinoCommon) will be pivotal no matter which language you choose.

1 Like

Hi TomTom,

I had seen some of the posts on the old forum, but I had read some conflicting info about it being outdated so I thought it may be best to pose the question.

Thanks for the tips on building a good foundation of basics. I’ll be sure to bare it in mind when I get started.

Regards,
Kevin

Great Anders,

Thanks for all of the help! It sounds like GHPython and RhinoCommon will be a great place to start. Thanks for the help!

Reagrds,
Keivn

1 Like