HI @Kareem,
One problem is that you provide a tree to the x input, which makes the GHPython component run for each tree branch separately. Since, you have only one item/brep per branch, there really is nothing to compare to for the single brep. You either need to flatten the x input, or if you want to keep the tree structure, provide a tree with at least two items per branch.
Furthermore, for i, b in x
doesn’t fly! For this work, x would have to be a nested list, with at least two items in each sublist (e.g. [ [b0,b1], [b2,b3], …, [bx,by] ]). What you have is a flat list (e.g. [ b0, b1, b2, …, bx ])
If I understand correctly, you want to evaluate each brep with the next brep in the list or tree branch x.
for i in range(len(x)-1):
print rs.IntersectBreps(x[i], x[i+1])
You have to subtract 1 from the length of the list or tree branch x, since the last brep in the list has no next brep to possibly intersect with.
Now, if you look at what is printed, you’ll notice that your if statement doesn’t work either. rs.IntersectBreps(x[i], x[i+1])
doesn’t return a boolean (e.g. True, False), but a list of intersection objects, curves or points, on success, or None on error or failure (cf. Reference).
In order to check if two breps intersect, you simply have to verify whether rs.IntersectBreps(x[i], x[i+1])
is not None.
for i in range(len(x)-1):
if rs.IntersectBreps(x[i], x[i+1]) != None:
print "Yeah, they intersect!"