There might be a more elegant solution than this but it seems to do the trick…
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)
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;
points = (curtWall.GetLocation()).PointAtParameter(params);
EDIT to add, I’d freeze the CurtainGrid.AddGridLineByPoint node and run a few times refreshing, until I see a combination of points I like. And follow this suggestion from the post you linked above: