Python to GH module

I like to get the attached python code in a GH module. Where would I start to learn the basics of that? I’m not a python guy yet.

The input should be an array of 3d points - numpy arrays sample call containing points.

The outputs:

  1. List of turtle movements
  2. A string representing the turtle movements
  3. a character dictionary

turtle3D.py (5.1 KB)

IronPython (the one used by Rhino/GH) does not support numpy. There are ways around this (search the forum), but none of these are straightforward, especially if you’re just starting out. Turtle-like algorithms are usually pretty simple, so perhaps implementing them from scratch might actually be a fun approach to learning some basic Python (as opposed to resolving complex dependency issues, which is rarely very much fun).

thanks for pointing out the numpy issues. I’ll try to find out the dependencies.

What are the GH libraries for dot-product and cross-product that are in numpy?

Found it, http://developer.rhino3d.com/guides/rhinopython/python-rhinoscriptsyntax-point-vector-methods/

Note that the rhinoscriptsyntax module (which you’ve found) wraps around the core Rhino API RhinoCommon, where this for instance is the vector 3D class. You can use this API directly by going import Rhino and accessing the namespaces/classes from there (which I’d recommend, but to each their own and such). Just for the sake of completeness and transparency, this can all be a bit confusing at first :slight_smile: