Importing Types to Python node


#1

Hi ,

I am facing this problem that when I want to create a geometry inside a python loop I don’t know how to import the type of that Geometry. for example I am trying to create a line inside a for loop and the method to create the line between two points require that I declare the Line type. In the documentation there is an example of importing elements from Revit.Eement but in this case I want to import this type I guess from the Geometry ?? This is the method I am trying to use:

Line.ByStartPointEndPoint = (startPoint: Point, endPoint: Point) :Line


#2

Hi Ghaith,

If you open up a new PS node, you already have all necessary imports to start creating geometry:

2015-07-31_16-47-12


#3

I’m not really sure what do you want to do, but, if you have some lists of points in Dynamo, you just need to enter them in Python like pointListA = IN[0] and pointListB = IN[1], then you can create

 

lnList = []

 

for i in range(0,len(pointListA)):

ln = Line.ByStartPointEndPoint = (pointListA[i],pointListB[i])

lnList.Add(ln)

OUT = lnList


#4

It worked thanks…! It was just that I rewrote it and I kept using the wrong one. Thanks for the prompt feedback.