Random Strip Widths

Planks are in 3 different widths which has to be randomly divided over the length of the wall: 145 mm - 50%, 95 mm - 30%, 46 mm - 20% and the gap between planks is 10 mm.

//Facade dimensions
l = 2;
h = 2;

//Panel widths
pw1 = 0.145;
pw2 = 0.095;
pw3 = 0.046;
spc = 0.010;

pw11 = pw1+spc;
pw21 = pw2+spc;
pw31 = pw3+spc;

//Panel count percentage
pwn1 = Math.Floor((0.5*l)/pw11);
pwn2 = Math.Floor((0.3*l)/pw21);
pwn3 = Math.Floor((0.2*l)/pw31);

pw12 = List.Cycle(pw11,pwn1);
pw22 = List.Cycle(pw21,pwn2);
pw32 = List.Cycle(pw31,pwn3);

a = List.Shuffle(Flatten({pw12,pw22,pw32}));
b = Math.Sum(List.TakeItems(a,1..List.Count(a))<1>);
c = b - a;
d = b - spc;

bp = Point.Origin();
dr = Vector.XAxis();

st = bp.Translate(dr,c);
en = bp.Translate(dr,d);
ln = Line.ByStartPointEndPoint(st,en);
sr = ln.Extrude(Vector.ZAxis(),h);

Last updated