Anemone Looping Component Question

Can a list of iteration values operate on a list of looping data so different data values are iterated a different number of times? For example, I would like the letter A to have two “X”s added to it, but I want five “X’s” added to the letter B. I’ve tried grafting and simplifying the two input lists, but I can’t seem to get this to happen. Any help achieving this is greatly appreciated.

Test File for Forum.gh (10.5 KB)

I tend to use Loops in GH when data is changing while looping, and the reason for that would be that it’s impossible for instance to forecast what would happen on future iteration 135

but if you know ahead, for each item, how many times you want it to be repeated, then next data is not depending on previously generated one, everything is “forecastable” from the beginning :upside_down_face: so I wouldn’t use a loop for that

Test File for Forum_noLoop.gh (9.8 KB)


this said, if you want to force a loop to create the function you illustrate, I would do something like:

Test File for Forum_a.gh (17.1 KB)

but if you want to go full hardcore and add a nested loop instead of repeat data, it might look something like this :slight_smile:

Test File for Forum_hardcore.gh (15.4 KB)

1 Like


Anemone_2024Nov3a.gh (12.5 KB)

You don’t need Anemone for this :bangbang:


Anemone_NO_2024Nov3b.gh (7.6 KB)

Hi Joseph

I have a more complicated problem that could be solved if I learned how to perform a looping function with a list of iteration values paired with a list of data. This more general case is what I am looking to solve and I tried to illustrate the challenge with a fairly simple example.

Regards,

Mike

I figured it was a learning exercise. But people often turn to looping when new to GH. If you have a more complex example, please post it?

Hi Joseph.

Ok, so here is the real problem. If my past learning curve is any indication, I’m betting you will have some approach to this that does lighter work of all this than my initial forays into the problem.

I’m also attaching a cluster I wrote, hoping it might help my cause. Thanks for your help.

Regards,

Mike


Reduce path by depth of 1.gh (7.5 KB)

There is no need for Anemone to do this.

Using Deconstruct Path, you can convert these paths into lists of integers and manipulate these lists with components of the Set > List panel. The manipulated result (still a list of integers), can be returned to paths using the Construct Path component, and consolidated as a tree by plugging them into a Data Path container.

Furthermore, the action you are performing is basically the method of Trim Tree with a depth of 2. Though, to use Trim Tree the number times of based on path depth would require the use of Anemone. Better just to manipulate a list of integers.

Here:


Reduce Path by a Depth of 2 _ Volker.gh (18.6 KB)

There is no internalized text input for your cluster. But for two reasons, it doesn’t matter:

  1. It’s too late. I would need the geometry that produces the complex list of paths to apply the Suirify component (‘Params | Util | Suirify’).

  2. Anemone won’t work inside of a cluster.