### Parametric Patterns X: Recursion

We at Buildz are very happy to welcome Steven Register for today’s lesson in recursion. I had given up on this pattern thinking that it was unattainable without the API. However, Steven opened my eyes and hopefully now he can open yours too. -Zach

[I've added another post on Recursion here.]

#### Recursion

“Create a pattern by recursively replicating a motif.”

The original intent of this series was to address the parametric patterns Revit could accomplish without coding. Recursion is one of those patterns, though, that I initially thought could only be done through Revit’s API. Though the API is probably the best route to take to do recursion, I still wondered if it could be done without it.
So my thoughts were like this:
· From my coding side I know that recursion means to have a piece of code call itself a certain number of times.
· Could a piece of Revit geometry “call” itself?
· Hmmm…
· From the old AutoCAD days I remember having problems with circular xrefs “calling” themselves.
· Eureka! Nesting!
· Recursion has depth and so does nesting! They are basically the same concept. Yes!
· Wait… will Revit have the same kinds of circular reference issues? Let me test.

Well, through my testing, I found a way to get Revit to do circular referencing without errors (although regeneration can be slow, so the API route is probably better).
So below is a video based on the dendritic/tree example from Woodbury’s site, but doing it in 3D in Revit (and without the coding from that example). The basic idea is to have 2 identical families with different names that get loaded into each other over and over again. The family in this video does require a small bit of trigonometry and Revit formulas to get the geometry the way I want, but you can do simpler geometry with no formulas for your own families and still use the nesting method that is demonstrated.

Recursion Part 1: Creating the Family

Recursion Part 2: Nesting the Family

So the summarized family recipe from the video is:
· Make one family (make sure it is not Shared) with some parameters, and then save as to make another (with a different name) with the same parameters.
· Then load the 2nd into the 1st, position it, and map the parameters of the nested family to the host.
· Save then load the 1st into the 2nd, position it, and map the parameters of the nested family to the host.
· Then just keep alternately saving and loading them into each other to get the recursion depth you want.

Steven Register is an unusual mix of Landscape Architect and Revit/BIM Manager. His training and practice in both Landscape Architecture and Architecture and his knack for all things IS has given him that strange brew. Since 2000, he has been titled a CAD\BIM Manager, but temporarily left that role in 2005 to begin using Revit for his own Landscape Architectural practice providing residential design services as well as 3D as-built and surveying services. In 2006 RTKL enticed him back into the BIM Management thing as the Applications Administrator for their Baltimore office where he currently provides Revit training and support for AE staff as well as Revit and AutoCAD API development for the firm.