Connecting corresponding points with lines

Hello everyone,

I’ve recently started learning grasshopper and python. I created a simple model that consists of frames with a pitched top and purlins. However, I have a problem with writing a script in Python that could enable me to have a free number of purlins. I create purlins by lofting a surface through a group of lines generated by dividing my frames with points.

I don’t know how to connect two corresponding groups of points together (with the same index) if my number of points is a variable. For now, I use if…elif to have 3 different options: for 4, 5 and 6 purlins:

I hope to be able to do it more automatically.

I attach the file, the script I have a problem with is called " Purlins in 2D’. Thank you for your help. If you have any other tips how to improve the model I would be very grateful. Starting out in python and grasshopper, most of the times I feel like I’m taking a shot in the dark. :smile:

Frame with purlins.gh (40.6 KB)

purlins = []
for i in range(num_of_purlins):
    p = rs.AddLine(ap[i],bp[i])
    purlins.append(p)

use this pattern

Thank you very much, it worked. :slight_smile: