Tree Iterator – Animate GH Data Trees


Dear “Diary”,

I know it has a while since I last wrote. But I recently had a great opportunity to apply part of my research to actual build geometry, and for that I am grateful.

In the meanwhile I thought i should share in the form of a .gha assembly a routine that I use frequently to animate data that get into my hands from grasshopper definitions that use Hoopsnake and Anemone(Lately). The main issue with these data sets is that while these two add-ons are running, due to their intrinsic characteristics, is kind of difficult to animate their wonderful iterative and recursive formations.

Canvas at 00;48;58

So, to be brief, what ever formation you create with these two looping tools, you can now easily post-animate it and iterate through the various steps of the solution.

The component is fairly simple to use. Data as input and a few toggles for different options of iterating. It can either work with a timer or by a slider. You will find it under the tab “Extra”

I will post the gha file and an example here and I will also include it in the Milkbox group of the Grasshopper3d forum.

Please bear in mind that this component is probably full of bugs, which I plan to resolve in the future.There is a slight change to include a stable version of this routine in the next version of Nudibranch. Please use it “as is”, it does not come with warranties. Please give credit where credit is due according to the CC license of this website.

Suggestion, comments, criticism are always welcome.

Cushion Panels Script in Python for GH


This is a code snippet I have been using long time ago written in VB. Just thought of re-writing the code in Python, which is clearer to understand, but I had some problems with datatrees so I had to change the structure of code resulting into a few more lines of code.


This routine utilizes rhinocommon (if you are looking for rhinoscript methods here, in this blog, you are terribly wrong), and simple list management. The code is pretty straightforward, as you can see.

#Library imports
import Rhino.Geometry as rc

#main routine
data_T = []
data_T2 = []
breps = []

for i in range(len(panels)):
    temp_list = []
    temp_list2 = []
    cn = centroids[i]
    nrm = normals[i]
    upper_p = cn+(nrm*height)
    upper_p = rc.Point(upper_p)
    lower_p = cn-(nrm*height)
    lower_p = rc.Point(lower_p)

for j in range(len(data_T)):
    ienum = data_T[j]
    ienum2 = data_T2[j]
    b = rc.Brep.CreatePatch(ienum,10,10,0.0005)
    b2 = rc.Brep.CreatePatch(ienum2,10,10,0.0005)

cushion_panels = breps

You can download the definition along  with the python code here.


Rossler Attractor Python Script in Grasshopper3d

Looking more into Python, the syntax and how you can use for loops, Rhinocommon and math within the GH Python Component, I decided to write and share this animated Python script of a Rossler attractor.  This particular attractor lies in the context of particle kinematics within chemical reactions. This system is defined by three non-linear ordinary differential equations originally studied by Otto Rössler. I find it to be, an extremely interesting and minimally beautiful system, mainly due to the particle’s easily observed movement in the Cartesian 3D space.



Thy python code looks something like this:

#”Rossler Attractor Grasshopper Python Component”
#Written by Marios Tsiliakos on 22/11/2012
#Based on the equations provided by Paul Bourke
#Rossler Attractor by Marios Tsiliakos is licensed under a
#Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
#Based on work at
from math import *
import _random as rnd
import Rhino
# Subfunction
def Rossler(it):
#random number
r0 = r.random()*0.1
# set the constants
a = 0.15 + r0
b = 0.2 – r0
c = 5.7 + r0
h = H
# provide the initial point
for i in range(it):
x0= x + h*(-y -z)
y0= y + h*(x + a*y)
z0= z + h*(b+z*(x-c))
#make the resulting coordinates the coordinates last point
x,y,z = x0, y0, z0
pts= Rhino.Geometry.Point3d(x,y,z)
#Main function
if Iterations == None:
Iterations = 1000
if H == None:
H = 0.05
if Seed == None:
Seed = 2
if Run== True:
#global lists
arrPts = []
var =[]
# always provide the creation of a curve by sufficient number of points
numpoints =counter+4
if numpoints < Iterations:
crv = Rhino.Geometry.Curve.CreateInterpolatedCurve(arrPts,3)
print counter
print “Rossler attractor with values: a =” , var[0][0],”b=” , var[0][1],”c=”, var[0][2],”h=” , H
if numpoints >= Iterations:
print “goal achieved”
# Comment out the next line to get the resulting points
#crv = Rhino.Geometry.Curve.CreateInterpolatedCurve(arrPts,3)
#counter = Iterations
Points = arrPts
else :
counter = 0

And here is a snapshot of the definition . You can download it at the usual place.