panels.gh (27.1 KB)

Quite a few steps, but it may be a start. The steps in this algorithm are:

- Import or otherwise specify the curves.
- Flip curves using a single guide line, so they all point in the same direction. This may or may not be important, I wasn’t sure.
- Divide the curves into [panel width] and [gap width] patterns. I used the
`Dash Pattern` component since it makes this really easy, however it measures the length *along* the curve, not straight in xyz space. You may need to switch to a `Divide Distance` approach instead, where the distance is `panelWidth+gapWidth`

.
- Figure out the start and end-point of all dashes. The panels will be centred on the startpoints and their direction is controlled by the end-points.
- Create World XY planes on the start points. I recommend setting your plane preview size to about 50 for a file with these units. You can do this in the Grasshopper Display menu.
- Align the planes using the span vector of all the dash curves. This will orient your panels correctly.
- Create rectangles of the correct width and height on each aligned plane.
- Extrude these rectangles to the correct height, giving you all the panels.
- Generate lists of random integers in the range zero to one. So for example if one curve yielded twelve panels, you’d want a list with twelve zeroes and ones, randomly distributed. (There’s a complication here, see bottom of post for further details).
- Multiply your zeroes and ones with your rotation angle. This means you now have a list of angles, some of which are zero because they were multiplied by zero, others are the correct angle since they were multiplied by one.
- Finally rotate your panels using the angles and the already computed planes.

Randomness (which is important to you in this case) is a lie in computers. It is impossible to generate really random numbers using deterministic machines. Instead, there are algorithms which generate pseudo-random numbers which typically look random enough to pass. We're not concerned with international-bank-transfer-cryptography here so who cares if it's not really random right?

A pseudo random number sequence is associated with a *seed* value, which is always an integer. Every seed *always* yields the exact same pseudo-random numbers. This is actually quite handy for people like us since we don’t necessarily want different panels to randomly stay in place or rotate each time we open this file. Repeatability is actually sort of a blessing.

Now, since you have a bunch of facade groups, you’d have to pick *different* seed values for each one otherwise they’d all exhibit the same ‘random’ pattern. You can absolutely do this, but I chose a different approach. Instead of generating N different lists of random values using N different seeds, I generated a single huge list of random values and then broke that one list into N shorter lists again. This can be done easily using the `Unflatten` component.