From the course: Grasshopper Plugins

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Python scripting in Grasshopper

Python scripting in Grasshopper

From the course: Grasshopper Plugins

Python scripting in Grasshopper

Combining scripting along with visual programming in Grasshopper is one of the most powerful combinations you can get in terms of creating custom geometry in Rhino. Let's take a look at a simple example of Python scripting. In Rhino, I've got the file, simple-fractal.3dm open, in Grasshopper, I've got 0040-python-begin.gh open. And so what we're aiming for here is to write a little Python script to make one of these fractal patterns. And in this case, I'm looking at this series of lines here. These are just pure Rhino geometry. I just drew these out myself, and we're taking a line as a starting point, duplicating that line, moving it one unit up in Y direction and making it half the length of the previous line. So I've started fleshing out my definition Grasshopper already. I've got this line parameter, which I've already internalized from Rhino, and then a number slider that's giving me integer, and that's going to determine the number of iterations or the number of duplicate lines…

Contents