ref: bd7c193d0174a2e258e1b0426edc80c1fbbd6922 turtle3D-grasshopper/README.md -rw-r--r-- 1.9 KiB
bd7c193d — Melody Horn add first draft of tutorial 1 year, 10 months ago

#turtle3D for Grasshopper

A Python library implementing 3D graphics in a way that can be used within Grasshopper.


Download the turtle3D.py script and place it somewhere on your computer, in a folder by itself. Then open Rhino, go to Tools > PythonScript > Edit..., go to Tools > Options, and in the Files tab, under Module Search Paths, click the "Add to search path" button, and then find the folder you put turtle3D.py in.


Add the following script to a Grasshopper Python node:

from turtle3D import *

right(90 + 45)
a = lines()

This will create a turtle automatically, provide it the given instructions, and output the lines it has drawn to the a output of the Python node.

Important: If you omit the call to home() at the start of the code, you will get a NullReferenceException when the Python node runs for a second time. I do not know why this happens, but I believe it has something to do with the fact that the implicitly-created turtle is persisted between runs of the Python node.

#Multiple Turtles

If you wish to create turtles explicitly, or you wish to keep imported names to a minimum to avoid name collisions, this code will have the same effect as the above code:

from turtle3D import Turtle

turtle = Turtle()
turtle.right(90 + 45)
a = turtle.lines()

#Full Tutorial

I've also written a full tutorial for this library.


This library is released under the terms of the Anti-Capitalist Software License v1.4.