Iteration in Grasshopper (Without scripting)

Heumann Design/Tech

Lately I have been experimenting with iteration in Grasshopper. Iteration is often thought to be synonymous with the computer programming concept of a loop, but while the concepts are related, the definition of iteration I will use requires that the results of one iteration are used as the starting point for the next iteration. A loop can simply be a way to apply the same operation to a list of elements (much like processing multiple values with a component in grasshopper), but it is an iterative loop if the results from one step are used in the calculation of the next step (something grasshopper does not directly do.)

This concept is also tightly linked with the concept of recursion. Simply stated, the definition of a recursive function includes the function itself. Fractals are among the canonical examples of recursion in mathematics and programming. Because recursion in programming describes a very…

View original post 1,013 more words

Advertisements

Loops and recursions in parametric modelling

I have come across this problem already twice in this month and by looking at this fascinating post on Andrew Heumann’s blog (and over 10,000 downloads of the GH plug-in Hoopsnake, for which I am sorry if I accidentally misinterpret in this post) it seems to make quite an interesting case.

What are loops?

It happens when you are trying to use some function or component, for example array. When you are taking data from it and establish relations with other functions or components and bring this data back to it, then you have a loop. A loop of data, which most of programs can’t apperenty work out.

At this point I should mention again, that if Hoopsnake actually did not have in purpose to deal with this issue, but just create “repetitions” of components let me know in comments. Anyway I am not going to write vastly about it anyway, because the best solution seems to lay somewhere else.

And namely, what I have firstly found out on Andrew’s blog, the best solution is instead of bringing data to the previosuly used function, simply copy it as a new one. Data can so flow and the loop is smoothly “omitted”.

Some examples

The first time it happened to me was when trying to trim a hexagonal pattern in Grasshopper, by using some of its information from and back to it.

1

2

The second time was when creating a set of stairs controlled by its slope’s angle in Revit Family Editor. However in the latter example the error was at least more evident, while all the parameters and all the formulas were arranged in a schedule and the already used ones were grayed out.

34

Great thing to learn and personally, so far the issue, which has brought the closest, as I have ever got before, to technical programming problems. I regret not describing both situations in GH and Revit closer, especially, becasue I have had already the images prepared, but.. well, time constraints are slowly bringing me into a loop.