The Tool "Variable changer"

Hi!
If someone would be able to help me, I would appreciate it a lot!
I am looking for a tool (python or c#), which will work as the changer of difined variables. These variables will be defined as Ranges in Input and I need the tool to produce one possible combinations of these variables, for example, every second. In order to start the tool I would like to have a buttom (or switcher) and the tool should go until all possible combinations are done (or the tool will be stoped). In the picture below are only 3 ranges to be seen, If you could programm the tool for 10 or more ranges, it would be fantastic!

For example in the 1st moment after the start it puts following combination of variables:

After this combination has been made, the following one will be in the output:

and so on…

and so on…

Sorry for a lot of images :wink: Thanks in advance!
Dalel

Hi,

You can use itertools to find the possible combinations. This does not find all permutations, if order matters, but should be a good start, depending on what you want to do.

2021-08-21 09-01-43.2021-08-21 09_03_38

This can also be done entirely in Python, but it’s easier this way.

permutate.gh (10.1 KB)

1 Like

Here is solution with C# code - recursive call to the method to determine every iteration.
On the result IterResult you can further perform your operations.


Iterations_v01.gh (15.8 KB)

1 Like

Thanks! A lot! Can this method be expanded with more input data sets just by adding them to the “Entwine” canvas?

Currently I don´t have acces to Grasshopper, so I can´t try it myself

Yes, you just plug-in additional data into “Entwine” and it will work.
The only condition is that input-set can not be empty set (if you plug in empty set method will not proceed to next level).

1 Like

Thank you a lot :slight_smile: