From the course: Grasshopper and Rhino: Python Scripting

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Creating and saving modules

Creating and saving modules

From the course: Grasshopper and Rhino: Python Scripting

Start my 1-month free trial

Creating and saving modules

- [Instructor] Importing different libraries and modules is a great way to extend the functionality of Grasshopper and get more out of our workflows. Another benefit of Python is that it allows us to create, store, and reuse our own functions by saving and importing our own Python modules. In this last exercise, we used a Python component to break up a list of points into different branches to create a data tree. Let's try adapting this component into a function, which we can then import into other Python components in separate Grasshopper files. To make this a little bit more useful though, let's change the script to break up a list into paths based on a slider input. To do that, let's double-click the left mouse button on the canvas and write 20 to create a slider. Then on our Python component let's add an input. We'll call this breakP, and we'll change this to type int and input our slider. Then double-click the component to open it up. So to adapt our script as we left it off, all…

Contents