Hi again!, from the last topic (How to INTERSECT MULTIPLE OBJECTS in one time?) I have asked about how to intersect multiple objects at the same time. Thanks to @HS_Kim who solved my issue! Next step I would like to know are there any solution to intersect them in all possibility that possible. As you can from my attached screenshot, in TEST2 have created number slider input for the list index but that is only for one to another. As in the panel in the screenshot I have listed all the possibility (12), but still stugging to script it in the right way.

@HS_Kim has spoiled you by answering your previous thread without any file from you. Most of us can’t (or won’t) do that unless the question is much simpler. Creating your geometry and duplicating your code from scratch is asking too much.

I agree with Joseph.
It’s a simple gesture: attach what you have so who try to help works on the real thing, not a “guess from a picture” that can be wrong, resulting in a waste of time.

… still… I ended up putting up something anyway.
To achieve the combinations a small gh algorithm or a Linq “one-liner” for the same result.
And a c# for-loop for the iterative solid intersection.

The number of combinations is c = 2^n , with n being the number of objects (or “switches”), in your case is 16, counting also the case of no solid selected.

Hello @Joseph_Oster , first of all sorry if my post made you think in that way. Actually I think opposite, but I understand your point. That day was myfirst day here so… and also sorry if my explanation might be confusing. That’s why I attached an image together with some description to make it more clear what I want to archieve because I don’t know much terminologies to explain it and just want to have some idea to be able to understand the logic.

You will find the link to my file below for both 3dm. And gh… Please be so kind to have a look and I hope this could show how sincere I’m and I hope you will happy to give me advice.

I wanted to vary the number of breps without rewiring the model so looked around and found this hint:

The CharSeq component is used in the orange group below. It gets REAL SLOW with more than five breps. I tried with seven which generates 961K combinations from 11 through 7777777 after culling (down from 1.65M sequences!!). The bottleneck is a Sort operation which takes 2.3 minutes, though total time is a bit longer to get 120 unique combinations.

Fortunately, it is much faster when the input is limited to 5 or fewer breps. I have a Data Dam to allow some fiddling with Jitter to choose a subset of eight possible breps.

Hi everyone, I want to thank you for all of your help and advices. I will have a look and try to understand all the scripts here. Thank you so much. I’m very appreciate.

By the way last night I have try something a little bit straight forwards with Galapagos. So I try to see the result of all that possibilities in term of Form and Srf area they have been produce. So that I would like to share it with you. The script is still not complete and correct as my little beginner skill right now and even not reached that all possibilities I want to explore as I don’t know how to set Galapagos to generate all option possible, but I hope it is make sense enough to illustrate what I would like to experiment.

Galapagos does not work like that, it does not explore all possible solutions, it navigates in the space of solutions. It starts with a set of configurations, evaluates them, selects the best ones and slightly mutates and combine their configuration to continue exploring for better solutions, and so on until it stabilizes, so it does not have to go through all the solutions, just the better ones. And that’s why it’s a method of optimisation, because instead of going through all of them, it goes through the solution space in the direction of the most optimal ones. If you want to permute, Galapagos is not for you. It is only useful for you if you are looking for those solutions in the set of permutations that minimize or maximize some feature.

Disappointed with the slow performance of my last post, yet still wanting to avoid hard wiring of CrossRef, I looked into Python. Had to struggle with tuples and lists but it’s WAY BETTER!

Tested with up to eight breps, the only bottleneck now is Solid Intersection which took ~25 seconds to produce 247 results.

All the “magic” happens in the small orange and white groups. The cyan group co-locates all breps at the origin so they will intersect. The yellow group displays the results in a grid (with labels).

from itertools import combinations
idx_st = [str(i) for i in idx] #convert integers to strings
combos = []
for i in range(2,len(idx)+1):
comb = combinations(idx_st, i)
for c in list(comb):
combos.append("+".join(c))
C = combos

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:

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