C# for Grasshopper Introduction

C# for Grasshopper Introduction

C# Coding for Grasshopper Course

What is the course about?

In this course we will be exploring some of the basic concepts of something called Object Oriented Programming using C# within Grasshopper for Rhino. We will explore fundamentals of writing code in C#, and examine how it can become a serious extension of your capabilities within Grasshopper.

The course will culminate in creating a simple physics simulation applying the logic we have explored in the lessons throughout the course.

No prior coding experience is needed to take this course. It is recommended that you have used Grasshopper previously, but the course is structured in a way that will enable new users and experienced users to both to engage with the tools available.

What will you learn in each video?

In this lesson, we’re going to create a C# component in Grasshopper and write our first line of code. Once we have creating our first C# component, we will examine the overall layout of the component, and explore the C# Script Editor, before writing our first line of code.

In this lesson we will examine some of the common data variables we will be using when writing our code in C#, as well as introducing the concept of variables and coming to grips with the basic syntax of writing in C#.

In this lesson we will examine how to inherit values from other grasshopper components inside the C# script editor, and take a quick look at visibility levels between the Runscript and the Custom additional code.

In this lesson we will learn to write our first ‘function’, which we will reuse in future tutorials. Functions can be helpful as a time saving technique when we have to re-use a piece of code over and over again.

In this lesson we will examine a type of code we will come back and write over and over again called a ‘for loop’. For loops will enable us to create an iterative operation on a piece of data, and can also be helpful for manipulating larger lists or collections of data.

In this lesson we will examine conditionals in C# as a means of creating ‘rules’ of what our code can and can’t do in certain situations. Conditionals rely on operations such as greater than/less than or true/false outcomes, which can help us impose rules and control our code when it’s not working the way we want.

In this lesson we will be examining the role of classes in OOP and creating our own class. This lesson is the first of 4 that will introduce some basic physics programming as a simulation of bouncing balls in 3D space.

In this lesson we will be animating the BouncingBalls class we made in the previous lesson. We will once again be using the grasshopper timer in conjunction with the C# component to iterate our code and run our animation.

In this lesson we will further develop our class from a group of moving points into a series of bouncing balls affected by gravity. We will write a function to create sphere instances to represent our balls, then we will add a gravity simulation and a bouncing plane to our code.

In this lesson we will introduce collision logic into our bouncing ball simulations by writing a collision function that will move our balls away from one another when they’re too close together. We will then create a separate simulation which combines inflation & collision behaviours as a simulation.

What are the learning objectives for the course?

Course image gallery:

Scroll to Top