### Parametric Patterns X.1: Recursion, encore

Ha, a little recursion joke there . . . sorry

I’ve been messing around more with Steven’s methods for creating recursion and finding some really simple, interesting and flexible methods that live within it.

#### Conceptually and Actually simple to set up

This is the most iconic example I can think of

And damn if it isn’t easy to make!

Simple Recursion

#### Performance: Simple and complex models

Complexity in these models doesn’t effect performance in a linear manner, but it seems exponential.  However, there seem to be 2 kinds of complexity, geometric and parametric.  On a relatively brief examination, geometric complexity, having more form elements and rigging, creates much less slowdown than additional parameters.  For instance, this model with only 2 parameters and a nested shared family with sweeps and blend regenerates in only a few seconds

but this one, with only model lines but with 8 parameters (some of which don’t even get used) takes over 2 minutes to regenerate.

#### Shared Families, using Placeholders

Key to the setup of the basic recursive structure is having 2 identical unshared families, each nested into each other.  There is a lot to discuss and understand about the difference between shared and unshared families, but for the purposes of this exercise, let’s just describe the difference for this application.  Unshared families act in relative isolation in nesting relationships.  That is, an unshared family can be operated on in the family that it is nested into, but is virtually undistinguishable from regular geometry once the host family is loaded into yet another family.  Shared families however keep percolating back up to the top in successive nesting operations, and retain their own “identity” if you will.

Recursion with Placeholders

This persistent rising to the top is interesting for recursion, as it creates an opportunity to plant a parametric seed at the root of a recursive system.  This allows you to nest and intelligent placeholder inside a simple skeleton of recursion, and later come back to make changes to that placeholder.

#### Triggering Events during recursion

When I showed  my friend Lira the basic tree she asked: “can you put leaves on it?”

The answer is a resounding “YES!”  In this example, there is a shared family that has a reporting parameter that detects when the family has gotten shorter than a given threshold.  At that point, a piece of geometry that has a visibility parameter is triggered.  The logic is “if  the stem length is less than 4 times the size of the leaf, make the leaf visible”

1. Great tutorial as usual. In Grasshopper you can do the same by using a slider. Can you show how to recursively replicate a motif through the API instead of going back and fort in the families? This will allow me to visually grow or shrink a motif in a single family or project environment.

2. Hi Peter,
Can you point me to any tutorials on doing recursion in Grasshopper as you describe it? Is there a looping function? I'm a super novice at GH but want to expand my understanding.
Afraid I don't know enough about the API to show you the way, but once the conversation gets into coding, these sorts of things should be pretty trivial.

3. Hi Zach:

My students and I have been enjoying reading your blog, especially the Parametric Patterns using Revit.

Steven Register's recursion method and your samples are brilliant.

Peter and Zach: I have created a sample Revit API program for creating recursive geometry, which can be found at the following page:

http://faculty.arch.tamu.edu/wyan/ARCH653/lectures/lecture16/1.html

See 1.4 - Method 3 (Using Revit API)on the page.

The API sample creates recursive boxes (in the Family Editor) from scratch and then assign a material to the boxes.

Hope this is helpful.

Best,

Wei

4. Wei, these are really interesting examples of getting to similar results in 3 very different ways. Your course looks fantastic.

5. The only way to create a recursion in Grasshopper is through some plug-ins such as: hoopsnake, galapagos(which is actually an evolutionary solver), kangaroo, etc. This is because by default grasshopper has some "locks" to prevent looping so you need to deal it with a custom made tool.
With out this the best approximation is to create array of numbers with different tools such as: ranges, series, fibonacci numbers, etc; but this are not recursions.