# Grouping intersecting curves

**URL:** <https://forum.dynamobim.com/t/grouping-intersecting-curves/92222>\
**Category:** Geometry\
**Tags:** dynamo\
**Created:** [July 26, 2023, 3:00pm UTC](https://forum.dynamobim.com/t/grouping-intersecting-curves/92222 "2023-07-26T15:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kira.rolding](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kira.rolding](https://forum.dynamobim.com/u/kira.rolding)\
**Post date:** [July 26, 2023, 3:00pm UTC](https://forum.dynamobim.com/t/grouping-intersecting-curves/92222/1 "2023-07-26T15:00:08Z")

</div>

Hello everyone! I’m trying to group all the lines that intersect with each other so that the ‘one’ list contains elements from the ‘two’ list only if they intersect with any of the elements previously added to ‘one’. The problem is that I’m getting only 2-3 elements in the result, whereas there should be more in the end.

 ![screen](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/7/67fbdf35a65fbf3af4a72f28f0670a451684240c.png)

```auto
two = IN[0]
outer = []

s = 0

while s < (len(two)):
    one = []
    one.append(two[0])
    two.pop(0)
    b = 0
    while b<(len(two)):
        counter = 0
        for z in one:
            if z.DoesIntersect(two[b]):
                counter = counter + 1        
        if counter > 0:
            one.append(two[b])
            two.pop(b)
        else:
            b = b + 1                      
    outer.append(one)
    s = s + 1

OUT = outer

```

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 26, 2023, 3:24pm UTC](https://forum.dynamobim.com/t/grouping-intersecting-curves/92222/3 "2023-07-26T15:24:44Z")

</div>

Arrrh didnt read it right ;))
