algorithmic modeling for Rhino
Hello,
I am trying to generate a list of all possible combination of two trees of breps. I have two lists, and each branch in each list may contain 2-4 breps (which is why I cannot flatten them out):
List A:
{0;0} - contains breps A, B
{0;1} - contains breps C, D, E
{0;2} - contains breps F, G
List B:
{0;0} - contains breps H, I
{1;0} - contains breps J, K, L
and want to create a list all possible combinations:
{0;0}
{0;1}
{0;2}
{1;0}
{1;1}
{1;2}
or thinking in a matrix format:
I feel like this should be very simple but I am having trouble figuring it out! Any help would be appreciated.
Tags:
...a list of all possible combination of two trees...
Combined in what ways? I would suggest the following small change to your description, since to me, each branch is effectively a list as far as GH components are concerned:
I have two lists trees, and each branch in each list tree may contain 2-4 breps
I've never used the 'CrossRef' component before but maybe this is a good time?
Thanks Joseph,
I was thinking of something a little more simple (perhaps "all combinations" is worded too extremely). The total possible combinations in my first example would be 6. More clearly illustrated this is what the combination would look like:
I've managed to make the list by duplicating branches within each list and weaving them. It seems to me that there must be a simpler way, though. I did take your suggestion of looking into "CrossRef" but couldn't manage to work my way through it.
I've attached the GH file in case it is helpful for clarity and for others.
Would still be interested in hearing about a better way for next time!
Pieter,
Yes! This is exactly what I was looking for. Thank you! That is perfect.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by