# Surfaces intersect

Hi Everybody,
I am trying to get the intersections areas (to define them as openings in floors later) as showed in the photo how can I get it by dynamo nodes or even python code ?

I tried to use Geometry. intersect by give me 10 items of intersections and duplicate many surfaces and when i try to get the unique items still give me the 10 items!

1 Like

Youâ€™re on the right path. First, `List.UniqueItems` only works for comparable objects and surfaces are not comparable. Thatâ€™s ok, youâ€™ll just have to handle duplicates another way. Second, you donâ€™t want to flatten your intersections since theyâ€™ll be grouped by surface already. Itâ€™ll be helpful to know which surfaces are intersecting later when you clean up duplicates. The problem right now is youâ€™re intersecting each surface with itself, so you end up with 4 extra intersections. Keeping the intersections grouped allows you to identify and remove the self-intersections.

1 Like

like thisâ€¦

KR

Andreas

1 Like

Yes, you got my problem here but can you tell me exactly how to remove the self-intersections from the list ?

I actually simplified my question but in the fact i have a dozen of areas intersects each other so i can not use code block to select that indices as you did to avoid the self intersection.
So if you can help by giving me a python code to use it in a wide way regardless the number of areas?

You know that each surface is going to intersect with itself so you either need to remove each surface from itâ€™s own list of geometries to intersect or you need to remove the intersection from its respective index after all intersections have been found.

Essentially, you either need to:

1. Create a specific list of viable intersections for each surface. (S1 can intersect S2, S3, and S4 but not S1).
2. Find all intersections and then remove the self-intersection based on indices. (With 4 intersections each, index 0 would be a self-intersection item 0, index 1 would be a self-intersection with item 1, etc.)

Option 2 is probably the cleanest and pretty straightforward with the use of `List.RemoveItemAtIndex`.

1 Like

Many thanks to you but i faced another problem after removed the self intersection i found 6 areas, and i tried to remove the duplicated areas but in vain beacuse dynamo consider them not eaqual? so any suggestions to keep only 3 areas ?

This is the part that requires a little creativity. I donâ€™t believe there is a way to definitively compare geometries, which means we have to do our best to make an educated guess and whatâ€™s considered â€śequalâ€ť. This basically means comparing geometric properties until you have a reasonable level of confidence.

This could be as simple as comparing surface areas. If you know you have considerably different geometries and can make pairs with matching surface areas, then you can pretty confidently say those are duplicate surfaces. You can continue this kind of comparison with other properties (like perimeter length or even specific perimeter curves) to whatever level of confidence you think is necessary.

All of that being said, you have an easy out in this scenario. Because youâ€™re already dealing with combined overlaps you donâ€™t have any areas of further congruence. Simply put, your intersections are already isolated so you can do a really easy comparison of just the center points. Iâ€™d use `GroupByKey` to group the surfaces by center point (points are still uncomparable geometries so youâ€™ll have to convert to a string) and then get a single surface from each group.

2 Likes

I really appreciate your time to help me and it works after I convert the center point to string and grouped them as you said.
Thanks again my dear friend,
God bless you always

hi
as well easy solution

2 Likes