Line.ByStartPointEndPoint with Python

Hi,
in some way the python function that i show i picture, will not work.
Is it effected by the list of point and not a point?

Is it a way to make it run in similar way as the boxes above?

Thank you.Capture

you should use looping

for n1,n2 in zip(nod1,nod2):
    linje.append(Line.ByStartPointEndPoint(n1,n2))
1 Like

As @khuzaimah.ElecEng says…

Your code works great for a single set of points…

This would work for either single or list… Someone will tidy my code :slight_smile:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import Line

point1 = IN[0]
point2 = IN[1]

if isinstance(point1, list):
	pointlist1 = point1
else:
	pointlist1 = [point1]

if isinstance(point2, list):
	pointlist2 = point2
else:
	pointlist2 = [point2]


line = []
for p1, p2 in zip(pointlist1,pointlist2):
    line.append(Line.ByStartPointEndPoint(p1,p2))


OUT = line

Hope that’s of interest,

Mark

2 Likes

Thanks, helps a lot :smiley: