Create curtain grid with ordered value from a list

Hi everyone, following topics about randomise grid of curtain wall, I want to create curtain grid with ordered value from a list like this:

This is what i currently have:


_Testing_Add Curtain Grids at Ordered Vals from List.dyn (22.2 KB)

Code Block
vals = DSCore.List.RemoveItemAtIndex(list, (Count(list)-1));
amount = DSCore.List.Count(vals);
seq = 1…#amount…1;
spaces = Math.Sum(DSCore.List.TakeItems(vals,seq));
params = spaces/length;
line = curtWall.GetLocation();
points = line.PointAtParameter(params);

Python Script
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

import sys
#The inputs to this node will be stored as a list in the IN variables.
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
import random

#The inputs to this node will be stored as a list in the IN variables.
vals = IN[0]
length = IN[1]
refresh = IN[2]

def addVals(nums,total):
sum = 0
vals =
i = 0
while sum<=total:
i = random.choice(nums)
vals.append(i)
sum+=i
return vals

OUT = addVals(vals,length)

I’m thinking about oppositing the random command (“i = random.choice(nums)”), which means taking the value from the list in ordered until reaching the length of the wall but I’m pretty new to Python script so I don’t know how to modify it. I’m looking forward for help. Thanks for your attention.