So I’m trying to combine data from a list into chunks, and then adding the values in each chunk into one number.
I’ve been at this for literally six hours now and I haven’t found an answer in any of the 50 topics I’ve read so far. I had hoped to solve it on my own, but I’m stuck and in way over my head.
The idea is to find consecutive values in the first part of each branch, merge them into a list with only one of each consecutive value.
And then add together the values that come second for each value accompanying the first value on each branch.
So for every consecutive occurrence of ‘1’, ‘2’ or ‘3’ on each branch, I want to add together the accompanying numbers, see this screenshot as an example:
I’ve tried Path Mapper, Treefrog plugins (from the Human package), but I keep running into things where things don’t click anymore. Components like delete consecutive
help me with the first list, but it does not offer an option to sort and add the values in the second list.
I hope someone knows the answer, it’s been quite a rough ride, I’ve learned a lot by looking at other topics, but I wasn’t able to make definitive solution for myself for this specific problem and I think it could be interesting in general.
To illustrate: I’ve also spent over half an hour finding out how to add three values in three separate branches before discovering I could simply explode the tree and use simple addition to add the values per branch… So I feel like I’m just looking in the wrong spot and thinking too difficult and it’s probably not even that hard in the end.
In this file I have added some explanation and a hand-written example, so I hope my data is complete enough to find a solution:
makingchunks-adding-branches.gh (22.3 KB)
After this is solved I am looking for a way to perform more consecutive operations on this data if I don’t manage to find this out on my own. So if you know of any handy components for consecutive calculations I would be more than happy to know about them. But it will probably come down to either path mapper expressions right?