Partition List based on a specific mass addition value

Hello All,

I want to divide a list into sub-lists. The mass addition of each sublist has to be 90.
As you can see in the image below, I have 3 different items (30,45,90) in it. The sub-lists have to be 30,30,30 or 45,45 or 60,30.

I could not figure it out. Any input/help is appreciated.


Use “Set” and “Member Index” to create 3 lists (or better, branches) containing all the 30s, the 45s, and the 60s.

Hope the 45s are even, and partition by 2.

Count the 60s, and split list the 30s for the same length and merge the two.

The remaining 30s do partition by 3.

Edit: You are new. Welcome! Please read this Help Us Help You

1 Like

Assuming one of those L’s in your grasshopper ribbon is Lunchbox you can use the Sort Duplicate Values component. Which is nice because it will put them in order as well, which the Create Set won’t do without additional components.

Thanks! It works.