Make loop in C# or python

Hi,

I would like to do loop but I cannot achieve it in python or C sharp. Can anyone help me to solve this?

duplicates-loop.gh (13.9 KB)

Moved to the Grasshopper catetory.

You state:

First item of each branch filtering duplicates
from above

Now … the only problem is to explain what this means (like talking to a stupid robot: (a) I have a tree, (b) I want to do …).

2 Likes

Hi Peter,
Sorry for late response. You can see I am repeating components in Gh file I sent earlier, where I need that to perform better like not repeating the components.

You can loop components with anemone

I tried hoop snake but cant make it effective. May be I am not connecting it right. Kindly help. I did make something similar with recorder. Please have a look at the definition. I compared metod 1 and method 2
Edit: Make sure to turn and off and clear recorder data beforte starting loop

duplicates-loop-update.gh (14.8 KB)

Did you try the plugin I suggested?

not yet but it works similar to hoop snake right?

No, it is different.

Ok I will try it. Thank you

Obviously I can see that. The only think missing is a clear explanation upon what exactly you are after.

2 Likes

Hi Peter,

I have a list with several branches, where these branches contains for example numbers ranging from 0 to 14 in different orders in each branch. I need to extract first item from each branch but if the first item is same as item from the previous branch then extract second item. Repeat this until you get all the non repeating numbers from each branch.

For example if there are 5 branches with 15 items then the end result will be 5 branches with 3 items which are non repeating in other branches. So total 5 branches and total 15 items in end. If its not clear please let me know.

Well … I’m not sure that the attached is what you want (some explanations conflict with I_Robot logic rule N666 (and maybe N667)) :

DataTrees_UniquePreviousItems_V1.gh (120.6 KB)

How it works (hard to imagine doing things like these with Anemone, mind):

  1. If there’s no userTree around it does an internal demo for you: there’s 2 Methods available for doing the chaos thingy (Fisher Yates is the classic one plus is very fast for BIG N or items).

  1. The logic has as follows (rather primitive I confess):

  1. The results are:

BTW: If a previous null is encountered this means that the search is over (no further unique items are possible etc etc) … but I left it running in order to make the result more explicit (wait: that’s a “bit” stupid if you have 1+Z branches to search, but anyway).

Perhaps this helps? Download Anemone.


Cull Duplicates_Loop_20190616.gh (16.3 KB)

2 Likes

This is pretty cool. Thanks