# Split multiple Lines by Points

**URL:** <https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235>\
**Category:** Developers\
**Tags:** python, geometry, dynamo\
**Created:** [December 11, 2020, 4:07pm UTC](https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235 "2020-12-11T16:07:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiscko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/luiscko/32/104053_2.png) [@Luiscko](https://forum.dynamobim.com/u/Luiscko)\
**Post date:** [December 11, 2020, 4:07pm UTC](https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235/1 "2020-12-11T16:07:16Z")

</div>

Hello, how are you? Good afternoon everyone, again I am struggling with Python within Dynamo  
So I wanted to see if any of you can support me

I want to evaluate if a point intersects the line or not and I want to create a dictionary with the points that intersect the line, now I am creating the definition but my question is how I could make these sublists within a general list  
My goal is to create a list with the points that intersect the line and then apply the splitCurves.By Points function.

Could you guide me a bit on how to do the syntax to achieve this, I am new to Python and it is difficult for me to change the nodes for the code.

This is the Code  
# Load the Python Standard and DesignScript Libraries  
import sys  
import clr  
clr.AddReference(‘ProtoGeometry’)  
from Autodesk.DesignScript.Geometry import \*

```
clr.AddReference('DSCoreNodes')
from DSCore import *

# The inputs to this node will be stored as a list in the IN variables.
Curves = IN[0]
Points = IN[1]

#Obtain the Exterior Columns
def SplitByPoints(Curves,Points):
	Count= 0
	EvList=[]
	for Curve in Curves:
		for Point in Points:
			Ev= Curve.DoesIntersect(Points)
			if Ev:
				Ev.append([Count]EvList)
	Count =+ 1
	return EvList

# Assign your output to the OUT variable.
OUT = 0

```

This is the context

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/4/84388bb66a204378b33d60704b8c1c3b4f88a9e8.png)

And here is the File [G-Structural-Grid-Forum-Split-ByPoints.dyn](https://forum.dynamobim.com/uploads/short-url/yn7c3qFc2rpaiGnDAIEWclLgssY.dyn) (14.6 KB)

---

<div class="post-metadata">

**Author:** ![Peter\_Kompolschek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Kompolschek](https://forum.dynamobim.com/u/Peter_Kompolschek)\
**Post date:** [December 11, 2020, 8:34pm UTC](https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235/2 "2020-12-11T20:34:48Z")

</div>

Why do you intersect points and not Single point in the loop?

---

<div class="post-metadata">

**Author:** ![Luiscko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/luiscko/32/104053_2.png) [@Luiscko](https://forum.dynamobim.com/u/Luiscko)\
**Post date:** [December 11, 2020, 8:52pm UTC](https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235/3 "2020-12-11T20:52:33Z")

</div>

This is the simple way to show the problem, in the real problem the list are not vinculate with each other so the problem can’t solve usign that aproach

---

<div class="post-metadata">

**Author:** ![Luiscko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/luiscko/32/104053_2.png) [@Luiscko](https://forum.dynamobim.com/u/Luiscko)\
**Post date:** [December 11, 2020, 8:55pm UTC](https://forum.dynamobim.com/t/split-multiple-lines-by-points/58235/4 "2020-12-11T20:55:21Z")

</div>

I show the code how to solve this problem. Gustavo Gonzales was the friend that solved this problem, thank you very much to help me.

```
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('DSCoreNodes')
from DSCore import *

# The inputs to this node will be stored as a list in the IN variables.
Curves = IN[0]
Points = IN[1]

diccionario = {}

for Curve in Curves:
	diccionario[str(Curve)] = []
	

#Obtain the Exterior Columns
def SplitByPoints(Curves,Points):
	Count= 0
	EvList=[]
	curves = []
	for Curve in Curves:
		for Point in Points:
			if Curve.DoesIntersect(Point):
				Count += 1
				diccionario[str(Curve)].append(Point)
	for curve1 in diccionario.keys():
		for curve2 in Curves:
			if curve1 == str(curve2):
				curves.append(curve2.SplitByPoints(diccionario[curve1]))
	return curves
		
# Assign your output to the OUT variable.
OUT = SplitByPoints(Curves,Points)

```

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