Missing some basic understanding of trees and intersections

Hi! I am hoping someone could help me understand the basic logic of intersections. I have 7 sets of surfaces and curves organized into 2 lists. Lets call them List S(for surface) and List C(for curve). Each list contains 7 branches. I want to intersect all the surfaces in branch 1 of List S with all the curves in branch 1 of List C, all the surfaces in branch 2 of List S with all the curves in branch 2 of List C and so on.

The problem is that it seems the Brep to Curve (BCX) component will take item 1 in List S-branch 1 and intersect it with item 1 in List C-branch 1, then item 2 in List S-branch 1 and intersect it with item 2 in List C-branch 1 and so on, rather than every item in the branch all at once.

How do I manipulate the lists so that I can intersect all the items in one branch to all the items in the matching branch?

I need to keep the 7 branches structure for the script downstream. I am aware I can graft 1 of the lists and flatten the other to apply EVERY SINGLE item to each of the items in the other list, and get a ton of null intersections, but this seems inelegant and does add quite a lot of processing time as I do this many times in my script.

I’ve attached a simplified version of the script. Let me know what I am missingexample.gh|attachment (36.0 KB)

example.gh (36.0 KB)

Cross Reference should work.

example-re.gh (41.6 KB)

1 Like

That seems to be the magic button I was missing! Thanks a lot! :smiley:

EDIT: if you have time, I would be super grateful if you say a few words about the logic of the method, so I can get a bit wiser about trees for the future. :slight_smile: But no pressure!

EDIT: So am I right to conclude that the cross-reference will create a copy of each itme onto a branch that corresponds to the reference list, basically creating all the possible permutations? And all these extras wont create extra computation time or null intersections since only the branches that actually relate to eachother will calculate intersections…? If that makes sense…

1 Like

Hi, I think I might have to ask a followup question!
I have a very similar situation downstream in the script, where I need to shatter a number of curves based on intersections with another set of curves. Similar problem as before, I can’t seem to apply one tree branch to the matching tree branch in the other set.

I have tried applying the cross reference again, but it does not provide the expected result… I don’t know if it is me not understanding the cross reference component properly or not understanding the curve closest properly. I’m attaching another example:

example2.gh (195.1 KB)

Also, if anyone has a good tutorial or guide that explains in a nice way exactly how the logic of the relationship between the tree branches of two lists apply to eachother, I would be very happy to see it as well. It really is doing my head in at the moment! Thanks!

example2_re.gh (376.4 KB)

Thanks! It’s a workable workaround (especially if changing from an extrusion to just a simple Srf) for sure.

I’ll still take the risk of sounding ungrateful though and ask if anyone can fill me in WHY my original method is not working. I have lots of similar situations in my script and I do really need to learn better how the logic of the trees work. Sorry, I just want to learn! :slightly_smiling_face: