For a project, I’d like to randomly generate a sort of L-shape form which always has 6 corners of 90 degrees each.

So far I have:

Randomly generated 2 lists of 6 random numbers within a given range to then form a list of 6 random points.

Use the approach described here to organize my points clockwise and create a PolyCurve from them.

I end up with the PolyCurve below for my given seeds. I am now looking for advice on how to transform the PolyCurve so that each of its corners become 90 degrees and the shape turns into the purple one which I drew. Any ideas?

It’s an interesting problem, but I think you’ve overcomplicated it quite a bit.

By generating random points and then realigning them to meet your specific requirements you’re doing a lot of work for nothing. I would suggest a more simplified approach that allows you to build up each requirement step-by-step, without any destructive processes:

Generate a random starting point.

Generate a random vector to be the first leg of the L.

Generate another random vector, perpendicular to the first, to be the second leg.

Generate a random thickness for the L (or both legs individually).

Widen the leg curves by the thickness value and combine the surfaces.

Thank you both! I started with Nick’s suggestion and will try Jacob’s as well next (to get more practice).

I do have a couple of follow-up questions:

What’s up with Surface.ByPatch? I was having the same issue as described in this post but it works fine when I restart Dynamo. Is that normal?

Might be an obvious question but what is the units when you specify the thickness in PolyCurve.ByThickeningCurveNormal? The lines are are roughly 7 and 14m, but I had to put temporary, non-random thickness values of 0.1 and 0.07 to get sensible dimensions. I’d like to have all dimensions be between 2 and 20 meters, so I put random thickness values between 1 and 10m but the curves ended up being ridiculously wide.

To end up with an L-shape right away instead of 2 overlapping rectangles, I figured I can offset my curves based on the generated thickness – is there another faster solution I am missing, though?

I can’t speak to that issue as I haven’t experienced it personally, but it might help if you run in Manual mode and not Automatic.

Internally, Dynamo is technically unitless. However it uses feet-inches when converting. If you’re using values from Revit or another source you’ll have to make sure the units have been converted.

That’s the way I’d probably handle it. It’s quick and relatively painless.

Okay! Here is my working solution using the first method. Thank you both for your help! The only thing that puzzles me is why that multiplication by 50 is needed to make sure the 2nd line offset is equal to the thickness, but I have tried with several parameters and it seems robust!