Rhino.Python training

rhino-python

Rhino.Python training

Python for Rhino and Grasshopper

This course is intended for all Rhino users who want to get started with the basics of Rhino.Python scripting or update their RhinoScript skills. Through a series of examples, you will learn how to handle basic Python codes, run macros to automate commands, perform calculations and successfully develop codes for geometry in Rhino 5 for Windows and Mac. You will also learn how to write your own functions, manage different data structures and extend your Grasshopper experience by combining it with iterative and recursive Python codes.

Course description

In this course you will learn how to write, debug and optimize our Rhino.Python scripts. We will start by getting familiar with the scripting editor, both in Rhino 5 and Grasshopper, run existing scripts, import and use Rhino functions. We will cover Rhino’s geometrical entities, building through vectors, points, curves, meshes, surfaces and polysurfaces, and analyzing where to find information on all their methods and obtain an understanding of the differences and potentials of different elementary types.

After this course, participants will have the foundations to:

understand how to run, edit and compose Python code for Rhinoceros;
identify and correct common bugs that can prevent code from executing;
distinguish variables, functions and other procedural and object-oriented paradigms;
find their way to access available resources both online and offline.


Course at a glance
  • 13 lessons – suggested one a day!
  • 570 minutes of learning experience
  • Quiz available for each lesson
  • Certificate of completion available
  • Language: English
Instructors
  • Giulio Piacentino
  • Assistant: Ilaria Giardiello
Prerequisites
This course is intended for established Rhino users, who are familiar with Rhino modeling techniques and interface. No previous Rhino.Python experience is required. A basic programing knowledge, though, especially with Python, will allow you to follow the class entirely.
Software requirements
Check out the introduction lesson to review the software requirements for this course.

← All courses

Lessons

Your first code: a personal 'Hello world' (Free Preview)

Length: 52 minutes

py-lesson-2

LESSON 2
In this lesson you will be introduced to the Rhino.Python programming language and the way it relates to the Rhino development environment, including RhinoScript and RhinoCommon. We will learn how to access the Rhino.Python editor and how to navigate its interface and functionalities.

Writing functions in modules

Length: 31 minutes

py-lesson-3

LESSON 3
In this lesson you will learn how to define functions and how to write functions in modules. We will also learn how to enrich our functions by writing documentation strings to provide some help when using them.

For loop and conditional statements

Length: 58 minutes

py-lesson-4

LESSON 4
In this lesson you will learn how to implement a for loop statement, to repeatedly execute a piece of code for a certain number of counts, as well as conditional statements to execute a piece of code only if some condition holds.

Parsing files and categorizing data

Length: 52 minutes

py-lesson-5

LESSON 5
In this lesson you will learn how to work with Python dictionaries. We will explore how to read and parse an external file and use the information to build our own dictionary.

String formatting and writing to external files

Length: 30 minutes

py-lesson-6

LESSON 6
In this lesson you will learn how to export the results of our code to an external txt file. We will assign, and combine in a formatted string, description and numeric properties to a series of Rhino objects.

The GH.Python component in Grasshopper

Length: 70 minutes

py-lesson-7

LESSON 7
In this lesson you will learn how to integrate Rhino.Python codes in your Grasshopper definitions, using the GhPython component. We will explore together how to use dynamic inputs (Grasshopper sliders) to evaluate in real time your code behavior.

Linear interpolation

Length: 45 minutes

py-lesson-8

LESSON 8
In this lesson you will learn how to implement and use, within the context of a recursive function definition, a linear interpolation function (also known as Lerp) to incrementally interpolate values within a numeric interval using a percentage factor.

Recursive functions

Length: 45 minutes

py-lesson-9

LESSON 9
In this lesson you will learn how to addrees recursive behavior by implementing a function that calls itself. In the example we will show how to build a Koch curve in Grasshopper and dynamically control the level of subdivisions with a slider.

Iterative functions

Length: 56 minutes

py-lesson-10

LESSON 10
In this lesson you will learn how to address iterative behavior by implementing a function that tests a condition in incremental steps. In the example we will show how to position objects along a free form shape at a minimum distance from each other.

Nested loops

Length: 50 minutes

py-lesson-11

LESSON 11
In this lesson you will learn how to build a three-dimensional grid of objects by using a nested loop to define the X, Y and Z coordinate of the base points. We will also construct the logic of an attractor point to define sizes based on distances.

Compile or embed your Python code

Length: 58 minutes

py-lesson-12

LESSON 12
In this lesson you will learn ways to deliver your code to external users, for example by compiling it or embedding it a Rhino button, a SharpDevelop form or a Grasshopper component.

A video hint for the Python clock assignment

Length: 13 minutes

py-lesson-13

EXTRA
During the course there will be suggested assignments to try to write, while learning, some code on your own. We will review most of the assignments during the course, for this advanced exercise we like to give you a video hint.