Separate data tree

Hi all,

I am trying to separate the list into two lists using the first numbers. That’s mean I would like to have a list from {0;0} to {0;3} and a list from {1;0} to {1;5}. But I have no idea which component is dealing with this problem. Hope to have some advice here. Many thanks!

Let me clarify the problem. I would like to extract the “0” item from the lists as shown in the below picture. No matter how long is the list, just the “0” item from the first and the last list.

Best,
HC

Try Explode tree

1 Like

Thanks for the fast response, but I think explode tree cannot deal with this :cry:

This could be one way.


SplitTree_re.gh (7.9 KB)

1 Like

Hi Kim,

Thanks for the response, but I am gonna apply it to maybe 100 lists instead of 2 lists. Do you think if there is another to filter the data?

Thanks,
HC

yes, sorry, I was confused

1 Like

No worries!!

I think that instead of trying to solve this issue, and leaving it abstract, tell what you want to solve in your definition. Personally I have never found the need to split lists this way, and that is after about 7+ years of using Grasshopper

Let me clarify the problem. I would like to extract the “0” item from the lists as shown in the below picture. No matter how long is the list, just the “0” item from the first and the last list.

-HC

Check this demo.


SplitBranch_re.gh (12.9 KB)

2 Likes

Thanks so much. It is very helpful!!!

-HC

i agree with @Gijs
check the logic of your definition and try to avoid a data-Structure like this.

but i like abstract questions :wink:
@HS_Kim would you mind adding a few comments on your definition.

i think the most readable approach to complex data-tree filtering is a scripting.

not sure if there is a smarter way to query the highest index at a certain position / sub-branch of a path. i just use a nested loop to do this - so attached script will only work for {A;B}(i) like Trees.

Selected_Data_with_csharp.gh (6.3 KB)

kind regards -tom

1 Like

Hi Tom,

I agree with you. Doing it in C# would be more straight forward to filter a complex data tree. But I am sure that my programming level didn’t reach that part haha.

Many thanks,
-HC

This could be a vanilla way, based on how I would do it in C#:


20210530_GetPaths.gh (10.6 KB)

2 Likes

dear @Baris nice solution regarding a pure grasshopper-component based approach.
not sure if i 100% understand the part:
shift +1
shift -1
smaller then
can you please explain in a few sentences ?

i feel more comfortable with a expression ;-(
(ok which is not 100% components…;-D)
ending up with this alternaive:
20210530_GetPaths_alternative.gh (11.8 KB)

kind regards -tom

1 Like

Seems I still have a lot to learn about the data tree.

-HC