Making corners of PolyCurve all 90 degrees from random points

Hello,

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:

  1. Randomly generated 2 lists of 6 random numbers within a given range to then form a list of 6 random points.
  2. 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?

This is my first time posting on here so please let me know if I need to provide more information in order to receive assistance!

Thanks :slight_smile:

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:

  1. Generate a random starting point.
  2. Generate a random vector to be the first leg of the L.
  3. Generate another random vector, perpendicular to the first, to be the second leg.
  4. Generate a random thickness for the L (or both legs individually).
  5. Widen the leg curves by the thickness value and combine the surfaces.
2 Likes

I’d go a different route.

  1. Generate a random coordinate system using values for the origin and X, Y and Z vectors.
  2. Generate a random point on the X axis, at the origin, and on the Y axis of the coordinate system.
  3. Build a polycurve using a Polycurve.ByJoinedPoints node.
  4. Thicken the polycirve using a Polycurve.ByThickeningCurve.Normal node, where the normal is the Z axis of the coordinate system.
3 Likes

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:

  1. 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?

  2. 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.

  3. 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?

Thanks again

  1. 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.
  2. 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.
  3. 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!



Still sounds like you have a unit issue somewhere, but the logic seems solid!