Hi
I´ve got a number of interesecting solids and wish to group them (put them in different lists).
I have to use the Geometry.DoesInteresect Node instead of the Bimorph interesection nodes, these solids are “virtual” and I don´t want to create DirectShapes to be able to use the Bimorph Element Element Intersection.
As a result of 10 objects I get a list of true and false values.
The list looks something like this (0 = False and 1 = True):
Here’s a solution using Python to determine the sets of intersections. I think that doing it with OOTB nodes alone is tricky because of the potential levels of nesting required to establish the groups
# Adapted from https://stackoverflow.com/a/4842897/8091631
intersections = IN[0]
out = []
while len(intersections) > 0:
first, rest = intersections[0], intersections[1:]
first = set(first)
lf = -1
while len(first) > lf:
lf = len(first)
rest2 = []
for r in rest:
if len(first.intersection(set(r))) > 0:
first |= set(r)
else:
rest2.append(r)
rest = rest2
out.append(first)
intersections = rest
OUT = out
You can simplify your inputs into Geometry.DoesIntersect by using cross-product lacing, instead of List.OfRepeatedItem
Thank you for the python code. I use it in one of my scripts.
Since i am new to python I have a additional question. Could you add another level to the script?
The input cubes in the example above is a flat list. However I have a script where i start with a three level list.
The expample below shows that I got the surfaces from walls, one of the walls is divided into two ‘solids’. This is why i have a three layer list.
I want to group the wall surfaces based on their intersection (in their own list, not to a flat list of all the wall surfaces) to later create a ‘cell’ with Topologic.