Loop data using Anemone or C# code

Dear All,
I’ve tried to loop my definitions using Anemone but I have problem to merge data to one list which has the same number of branches (but shifted -1) and what is the most important the same numbers of items in each branch (in this particular example - 20).

When it didn’t work with Anemone I’ve tried C# - the problem with C# is how to:

  • choose all items index in each branch of data tree
  • shift path -1 data tree
  • check if each of branch shifted path data tree contains 0 or 1
  • if all of items in each branch is 0 - return 0
  • if only one item in each branch is 1 - return 1

In C# code should I try to convert data tree to jaggedArray or there is simpler way like to make shift path data tree based on Grasshopper API?

I hope my question is clear for you. I’ve attached also the file with one iteration grasshopper definition which I want to repeat , my not-working Anemone definitions and C#script.

Looking forward for any advices to move forward in Anemone or C# script.Loops data with Anemone or C# with shift path_final.gh (25.6 KB)

Hmmm, if I understood what you want correctly, I think you don’t need any kind of iteration to solve this:

data operation_v01.gh (18.0 KB)

PD: ‘Flip Last’ is a component from the plug - in Treesloth. As I like to avoid using plug-ins, Andrew helped in replicating it with native components.

Alternatively, you can shift paths and partition the list by 4. But ‘Flip Last’ is a more generic answer that should work for all trees.

It works perfect.Thank you very much.