# Match list elements and set sorting

Hey,

I want to create openings on floor. (I’m using the intersection of MEP duct and floor plane as start element that results in a surface) As I have to merge some opening (they are close) I’m using circles drawn above each opening and if they intersect, I will union them, put a bounding box around them, create a new bigger surface that will represent the floor opening.

So in general I have the idea what I want to do, I’m stuck with one point.

I have a list of surfaces and a list of circles. I’m grouping the circles based on their distance (distance is 0). But this changes the list order and I’m not able to match it with the surfaces.

So I know what is the problem but can’t seem to find a solution.

What’s in the picture:

1. I’m thickening the surface in order to find it’s center point to draw the circle.
2. I’m drawing circle and using a custom node to group them by distance
3. Grouping them by distance mixes the original order of the elements
4. So when I chop obviously they are not matching.

I hope my problem is clear, if anyone can support with an idea it is appreciated

Aren’t the result solids the combined representation of those duct intersections that are close to each other (on the same shaft)?

Following the logic you described, after this is were you would create the bounding box and bigger surface for the opening.

Well the solids are in one order, let’s say

1
2
3
4
5

I’m grouping them based on their distance and the list looks like

1
3

2
4

5

So the order is different for obvious reasons. When I apply the same chop to the original list it is

1
2

3
4

5

And this way wrong solids are getting grouped together

Kind of a shot in the dark here, but I’m pretty sure this would do what you’re looking for if I’m understanding correctly… create a flattened list from your list of solids and list of circles, input that list into the Springs.Geometry.GroupByDistance node, and then filter by object type to remove the circles from your list of grouped geometries. I’m not sure what all your geometry is like but it worked for me with a small sample

1 Like

Group them then after it remove circles. It was too simple I was going into super complicated stuff

Thank you

Ok sorry, I misinterpreted your graph

I would suggest to group first the ducts solids prior to intersect them with the surface to save you the overhead of creating intermediate geometry, it seems to work quite well:

Otherwise if following your process, you can flatten the grouped output and select the index of these elements on the original list, chop the list of indexes and select them from the original list:

I would use the first option though, hope it helps

You are right. However what if:
One of the duct does not go down to the below level with the others. Very typical with shafts. Because at the end if I put a bounding box over it it will include all the ducts.
So I have to slice level by level and I must treat them separately. So I prefer to first intersect it, have separate surfaces then group them.

Fair point! Grouping the surface intersection per plane would do the trick then.

But anyway drop the circles was a simple and good idea. I don’t even know why I complicated it.

Thanks