grasshopper code

. a collection of codes & grammars for Grasshopper, a generative modeling tool for Rhinoceros.

Hitomezashi Pattern

The definition create a specific Hitomezashi pattern.
There are a Nurbs and a Mesh version of it.

Mesh Color by Curvature

The definition applies a vertex color based on the average or upper value of the angles between adjacent faces.

3D Hilbert Curve

This definition generates a 3D Hilbert Curve, a continuous fractal space-filling curve.

nGon mesh tessellation

Starting from a closed surface it builds a nGon mesh tessellation

Curves Sorter

Starting from a list of curves it takes the first one then it looks for the closest curve and it eventually flips the direction to optimize the toolpath lenght.


froGH panel_thumb

A sparse collection of tools for Grasshopper.

See the code, explanation and download here.


This definition groups indexes of connected points into separate clusters. It requires Sandbox & Anemone plugins.


This definition simulates a spirograph tool.

3D Differential mesh relaxation

This definition explores the 3D relaxation of a mesh effected by an image gradient.

2.5D Differential mesh relaxation

This definition explores the 2.5D relaxation of a 3D mesh by a system of attractor points forces.


This definition creates a mesh model of all the connections between the centers of the 3D voronoi cells and the adjacent cells.

2D Differential mesh relaxation

This definition explores the 2D relaxation of a mesh by a system of acctractor points forces.

3D Hexagonal Weaving


This definition explores the weaving of an hexagonal grid providing 3 different interwoven frames.

Vectors field over HexaMesh

Vectors field over HexaMesh_thumb

This definition explores the deformations over an Hexagonal grid by a vectors field of point charges and the colors of the resulting mesh are driven by the field values.

Vectors field over

Mesh faces by deviation angle

Mesh faces by deviation angle_thumb

This definition selects adjacent mesh faces depending on the angle of deviation. It requires Hoopsnake & Starling plugins

Mesh faces by deviation < package ( for GH v.0.9.0066)

Erwin Hauer’s Box Morph

Erwin Hauer's Box Morph

This definition explores the Box Morph technique to get the Erwin Hauer’s continual surfaces using meshes.

Erwin Hauer’s Box Morph_Co-de-iT_0.9.0066 < package ( for GH v.0.9.0066)

Math surfaces

Math surfaces_thumb

This definition provides several math surfaces (nurbs and mesh) based on k3surf formulas.

Math < package ( for GH v.0.9.0066)



Custom user object (written in C#) to find the mathematical intersection(s) of 3 spheres.

you can dowload the files (user object + sample gh definition) here:


GH to SVG_thumb

A serie of Clusters/Components in order to export and visualize directly a SVG file

you can dowload the file at:

ASCII art generator


This definition uses any image to create a AASCII art picture.

ASCII art < package ( for GH v.0.9.0014)

Recursive subdivision

GH_recursive subdivision

Recursively subdivide a surface in order to minimize panel curvature (tested by keeping the distance between the centroid of the subsurface and its projection on the subsurface itself below a given threshold). Uses a C# custom component. It will all be a lot clearer if you give it a try. 😉

GH recursive  < package ( for GH v.0.9.0014)

Tangent threshold

GH_tangent threshold

This code samples one or more curves and, for each sample point, gives the points in both directions whose tangents form a given angle with the tangent of the given point. In narrow curvature zones the two given points will tend to be close to the original one, while in straighter zones they will spread farther. Uses a C# custom component.

GH_tangent < package ( for GH v.0.9.0014)

Koch Snowflake [Hoopsnake]

Koch Snowflake_thumb

This code creates a Koch Snowflake 2D fractal using the Hoopsnake component

Koch < package ( for GH v.0.9.0014)

Sierpinski Triangle [Hoopsnake]

Sierpinsky's Gasket_thumb

This code creates a Sierpinski Triangle 2D fractal using the Hoopsnake component

Sierpinski Triangle < package ( for GH v.0.9.0014)

Gradient Descent Algorithm

gradient descent algorithm grasshopper3d

This code creates a Gradient Descent algorithm on a surface generated by an image sampler logic. There’re two type of the algorithm: normal and rotated. The package includes a GH definition, the Rhino 3d file and a map used for the image sampler component.
N.B.Original VBnet code by Woo Jae Sung.

Gradient Descent Algorithm.rar < package ( for GH v.0.9.0014)

GH to Maya

GH to Maya

This tutorial package includes a GH definition with a method to preserve mesh vertices colors after welding and explains a pipeline to render vertex-color meshes in Mental Ray in Maya. Included are: GH definition (v 0.9.0014), Rhino 4.0 file, .fbx mesh sample, .mb file with finished result

GH to Maya package < the full package (for GH v. 0.9.0014)

GH to Blender

GH to Blender

This tutorial package includes a GH definition with a method to preserve mesh vertices colors after welding and explains a pipeline to render vertex-color meshes in Blender with Cycles. Included are: GH definition (v 0.8.0060), Rhino 4.0 file, VRML mesh sample, Blender file with finished result

GH to Blender package < the full package (for GH v. 0.8.0066 + GH v. 0.9.0006)


A definition that draws custom size cubic voxels onto a surface or polysurface. < Grasshopper definition (for GH v. 0.8.0066) < 3dm Rhinoceros file

Ribs Structure

This definition creates  from a given Nurbs surface  a Ribs structure and all pieces unrolled.

RibsStucture_Co-de-iT_GH080066 < Grasshopper definition (for GH v.0.8.0066)

Strip fabrication

Fabrication of single-curvature striped surfaces. A study based on the Strip Morphologies technique by ©StudioMODE

Strip morphologies_Co-de-iT_GH080066 < Grasshopper definition (for GH v0.8.0066)

Seamless Pattern

. A simple GH definition that mimics the Escher patterns process.

Seamless < Grasshopper definition (for GH v0.8.0066)

DiY Architectural Dialogue machine.

DiY machine

. insprired by this post –
i did a GH def to sort random strings from several lists of data in order
to do an architectural dialogue machine.

DiY Arch < Grasshopper definition (for GH v0.8.0010)



a simple GH definition to import a Blender3D geometry using the export .PLY file format < package including:

. Blender3D file (for Blender3D 2.57b)
. export .PLY file
. Grasshopper definition (for GH v0.8.0010)
. Tutorial (PDF file)



Random hexagonal based pattern generator < Grasshopper definition (for GH v0.8.0010)

Uneven Subdivision.

Uneven Subdivision

Uneven subdivision of a NURBS surface, controlled by random intervals.

Uneven < Grasshopper definition (for GH v0.8.0004)

Complete Diagrid.

Complete Diagrid

Diagrid definition that covers the whole surface, up to the edges.

Complete < Grasshopper definition (for GH v06.0059)

Phyllotaxis growth.

Phyllotaxis variation working on variables with a few changes of the values “i” in the math formula of spiral: x= cos(i), y=sin(i), z=i

phyllotaxis growth_Co-de-iT_GH06057.rar < Grasshopper definition (for GH v06.0057)


Phyllotaxis 2D pattern.

phyllotaxis_Co-de-iT_GH06057.rar < Grasshopper definition (for GH v06.0057)

Curvature analysis pattern.

This definition subdivides a surface into a quadrangular panels, plots a circle or a closed spline(similar to an ellipse) with center in the centroid of each panels, scale the radius dimension trough a numeric values extrapolated from the curvature analisys of the input surface.

curvature analysis pattern_Co-de-iT_GH06057.rar < Grasshopper definition (for GH v06.0057)

Attractors vector deformation.

The complex structure of radiolaria was treated as a two-dimensional representation with a hexagonal pattern. Two points control the deformation of individual cells that make structure through a transformation of vectors connecting the vertices of the single cell with the point. The deformation of the grid can be caused by an attraction or a repulsion generated by attractor points.

attractors vector deformation_Co-de-iT_GH0657.rar < Grasshopper definition (for GH v06.0057)

Image field04.

Investigation on the potentiality of numerical field generated by a source image. The height of one ellipse control point is linked with grayscale value of the image generating parametric variations in the starting flatten pattern.

IMAGE FIELD04_Co-de-iT_GH06057.rar < Grasshopper definition (for GH v06.0057)

Pie chart.

pie chart

A definition that draws a percentage pie chart from a list of values (random values are used here but you can plug any list of values including external data).

Pie < Grasshopper definition (for GH v06.0059)

Panels dispatch

Panels dispatch

This definition allows you to tessellate a surface with two different panel types dispatched through random sorting.

Panels < Grasshopper definition (for GH v06.0019)

Panels < 3dm Rhinoceros file

Quad 2 diagrid

Quad 2 diagrid

This definition allows you to tessellate a surface and smoothly transform the tessellation from a quadrangular to a diagrid pattern.

Quad 2 < Grasshopper definition (for GH v06.0019)

Quad 2 < 3dm Rhinoceros file

Hexagonal field

Hexagonal field

A magnetic field applyed to an hexagonal grid ruled by 4 points that can be switched (attractors or repulsors).

Hexagonal < Grasshopper definition (for GH v06.0019)

Hexagonal < 3dm Rhinoceros file

Tatami-Cairo-Diagrid tessellation


This definition allows you to tessellate a surface going smoothly from tatami tessellation to diagrid through Cairo tessellation. < Grasshopper definition (for GH v06.0019)

Curve driver

Curve driver logics

This definition allows you to control geometry properties (curvature radius) through a control curve.

Curve < Grasshopper definition (for GH v06.0019)

Curve < 3dm Rhinoceros file