# Python - Dividing line on point of intersection

**URL:** <https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356>\
**Category:** Revit\
**Tags:** revit, loop, python, geometry, dynamo\
**Created:** [December 13, 2017, 11:18am UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356 "2017-12-13T11:18:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe.ashton](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Joe.ashton](https://forum.dynamobim.com/u/Joe.ashton)\
**Post date:** [December 13, 2017, 11:18am UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356/1 "2017-12-13T11:18:07Z")

</div>

Referring to: [Python - Working with arrays](https://forum.dynamobim.com/t/python-working-with-arrays/17324/4)

After getting help with the above problem, I’ve encountered my next one already.

My end goal is to split intersecting lines on the points of intersection, so 2 lines forming a T sections will turn into 3 lines and 2 lines forming a cross will split into 4 lines.

In the referred topic, I worked out the distance, I now want to make it so if the distance is within a set tolerance to split at that point.

I’ve looked at Curve.SplitByPoints but I don’t know how to format code to get it to do what I want.

I’ve looked at an If statement, such as

If distance \> tolerance  
curve.splitbypoints(Curve,points)

but like mentioned before not too sure on how to turn that into code.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![visualizor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/visualizor/32/29555_2.png) [@visualizor](https://forum.dynamobim.com/u/visualizor)\
**Post date:** [December 13, 2017, 2:12pm UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356/2 "2017-12-13T14:12:58Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/7/474512ff665d03b312a9dceb9b86280a2186cdb9.png)

like this maybe?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [December 13, 2017, 2:50pm UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356/3 "2017-12-13T14:50:02Z")

</div>

You can use ScopeIf+ from Clockwork like this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/9/a989d0cb71f26996b6e93b81a3980a79fe0ef94c.png)

If you need it in code you can use something like this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/6296d554a56080dd557fe4e478917b138914ad4b.png)  
(You can wrap the functions inside the codeblock if you want, I was just showing the format you need to use.)

---

<div class="post-metadata">

**Author:** ![Joe.ashton](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Joe.ashton](https://forum.dynamobim.com/u/Joe.ashton)\
**Post date:** [December 13, 2017, 4:25pm UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356/4 "2017-12-13T16:25:01Z")

</div>

Thanks, was trying it as a little python project to improve my skills in it. but since Its needed for work, il use this for now! thanks for the help

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [December 14, 2017, 1:57am UTC](https://forum.dynamobim.com/t/python-dividing-line-on-point-of-intersection/17356/5 "2017-12-14T01:57:27Z")

</div>

For experimenting with later (eg. processing more than one element set to intersect 😉 )

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/5/656665a2164bc22d03d77476ff99c6416a0326f2.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/f/2f99370bf284bfbb5b4da7f808132cedeb740a75.png)

> import clr
> 
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> c1=IN[0]  
> c2=IN[1]
> 
> for c in c1:  
> x=c.IntersectAll(c2)  
> y=c.SplitByPoints(x)
> 
> OUT = y
