Partitioning lists based on a jump in consecutive values

Hi there,

I have a problem i have been working on and cant seem to get it.

I have a data tree with different lists in it. Now I want to partition this data based on whether a value jumps from consecutive numbers to a higher number. (instead of N+1, it jumps to N+…).

example: data = 1,2,3,4,5,6,22,23,24,25,26,27.
Now i want to partition this list into: 1,2,3,4,5,6 AND 22,23,24,25,26,27.
For one list this can be done manually, but i have many of these lists in my data tree of which the jump in value of the consecutive numbers is not constant. How do i partition this parametrically?

many thanks in advanced!


PartitionNumbers_re.gh (11.7 KB)

Thanks alot Kim!

You have an elegant way of doing this. In the meantime i got my own work around seen in the image here, which seems to work fine. but ill see if your method has benefits for my script;)

Kim!

i see now that my node setup doesnt work at all XD thanks alot, i will still use your way of doing this!

greetings!

based on @HS_Kim start:


File:PartitionNumbers_bw.gh (8.8 KB)

2 Likes

HS_Kim - how do you display the name of the component above it? I like that look, but can’t seem to find the setting! Thanks! Tom

It’s the sunglasses plug in:

1 Like

Thanks!

this does not work for me since i use a data tree with several lists… de “replace list” component does not work since the output of the mass mulitply and the output of the “path as list” do not match in amount of items. im trying to match them in some sort of way, but cant seem to figure it out :frowning: anyone with a quick solution?