I realized later that my Python struggles with string join ( "+".join(c)
) and converting integers to strings could have been avoided using a ‘Type hint’ of ‘str’ instead of ‘int’. This also makes the code much more flexible since it will work with a list of characters or words as well as integers (or reals?).
This is a simple demo of the modified Combos Python component using characters:
Combos_2021Jan15a.gh (10.0 KB)
The slightly simplified Python:
from itertools import combinations
combos = []
for i in range(2,len(vals)+1):
comb = combinations(vals, i)
for c in list(comb):
combos.append("+".join(c))
C = combos
And the revised Solid Intersection model:
intersect_2021Jan15b.gh (48.4 KB)