Creating a simple Clash Matrix

image
Hi everyone,
I don’t remember how many times I searched and learned from this forum, you guys are just an amazing community.
So this is my first post on the forum.
I have this list [A,B,C,D,E] which could represent a group of search sets, I want to run a clash test between theses sets without duplicating the tests (I’m pretty sure most of you will relate), I worked on xml editor to get the clash test lines that should precede the search sets, but the only trouble is how to get the list that will contain the unique tests list.
I know this must be a very simple coding task but I’ve been trying the whole day without any luck, even AI couldn’t help obviously or I’m just lost and don’t know how to give the right prompt.
Thanks in advance.

Using the length of the list, you can get a count for how many intersections each group will have (5 groups = 5, 4, 3, 2, 1 intersections in your example). You can use that number to get that many items from the list for the intersections of the respective item. It’s much simpler if the order doesn’t matter (ie. A has only one intersection with itself and E has intersections with all 5 groups) but you can still get your example outcome if you flip the count and offset the items.


3 Likes

Hi @abdulaziz.alshaikh,

Welcome to the community!

You can use the List.Combinations node to get that result.

4 Likes

Thanks Nick, so yeah that ultimately did the trick, thanks man I really appreciate your help, one question though, how do I know about scripting in the code blocks instead of inside “Python Script” ? I see people use this method regularly (especially when I was looking for a way to do an if condition) but the syntax looks a little bit strange to me? is there a source where I could get a deeper look at the syntax ( for example offset=0…#count…1; this looks very “new” to me)
Again thanks for the help I’m really grateful :pray:

Thanks Amol,
You really did it in much simpler way, I wonder where do you guys get to know about the usage of these nodes, I already made some advanced dynamo scripts like this one (Abdulaziz Al Shaikh, ACP, BIM on LinkedIn: Working on mega-scale projects is a perpetual challenge, and one of the…) but now I just found that I’m still far behind when it comes to the basics :sweat_smile:.
Any Idea where I can find more examples about the use of the other List nodes?
P.S I wish I could mark your reply as a solution but the forums only allows one reply to be marked as a solution.
I really appreciate your help Amol.

I wonder why it gives me this instead of your result though!

OK Turns out the list should be flattened, again thank you.

1 Like

hello, I tried with a python version very strongly inspired by a post by Mr. Poupin

import sys
lst=IN[0]
OUT = [f'{val}{lst[j]}' for idx,val in enumerate(lst) for j in range(idx,len(lst))]

Cordially
christian.stan

3 Likes

Thanks Christian :smile:
Yup that’s another way, as simple as it’s just in one line, there’s deep knowledge behind this line for sure.

1 Like

In all objectivity, mimicry more than competence (competence is elsewhere)
cordially
christian.stan

1 Like

Work your way through the Dynamo Primer and continue studying threads in the forum that explain the basics. It just takes time.