# Splitting list

help.gh (5.6 KB)

Hello, I have an apparently easy question, but I’m here so I wasn’t able to find the solution.
GH and Screenshot attached. How to group the indices with numbers and to remove the groups with zeros, but keeping the groups with numbers separeted between each others?

So I’ve got something like:
0
0
0
1
1
1
0
0
0
2
2
2

And I want a group {0} with [1,1,1] and a group {1} with [2,2,2].
I know I need to use the Sub List (SubSet) component and I know in my list attached I need to create a logic that creates the following domains: 0 to 9, 10 to 68, 69 to 109, 110 to 174 (if I want to keep the zeros) or, even better, just these two domains: 10 to 68 and 110 to 174, in order to keep the two groups with numbers.

I hope you can help me. I already found this: Splitting a list from excel... - Grasshopper
But I’m not able to figured it out still.

Thank you for your time and effort. Best,
M.

it’s bedtime… I am not at my best anymore

but I think this is what you need

help_dk.gh (27.5 KB)

2 Likes

This is a nightmare with native components !

Here is a solution but I’ve also included a C# block that does the same thing.

help.gh (17.1 KB)

Thank you dk2079 for your effort… I’m not sure you got the problem, for sure due to my not precise explanation or maybe the bedtime I think next replies will help you to understand the problem better.

Thank you @magicteddy ! it seemed to be a quick and easy stuff but it wasn’t.

In these days I’ve found a solution, I think is not clean as yours, but I wanted to share it with you guys for the help you gave me. What do you think about it?

Since I’m not a C# guy, do you think you can modify your C# block and outputting also the lists with the zeroes? Is it difficult?

Many thanks,
M.
help_dk_mf.gh (71.5 KB)

It’s not that hard. Compare what’s in the current branch (all zeros/at least not a zero) and compare it to the previous branch. If it’s not the same state, start a new path in the output tree, else keep going in the current branch.

help_dk_mf.gh (75.4 KB)

Okay wow! Many many thanks @magicteddy !

I would like to inform you about my work when it’s done, so I hope you can see the real results of your essential help. <3

Best,
M.

1 Like