Square Piping Orientation Help

Sorry I don’t know how to best phrase this question, but it is simple…
I want to square pipe some lines, and I need help constraining the rotating planes for the pipes. I used “plane normal” to create a plane perpendicular to the lines I want to pipe, but the planes’ x/y also rotate, resulting in unwanted rotation of pipes around the axis. This is for timber framing, so the resulted “pipes” should have their edges on the same plane. How can I control this? Many thanks.

The images explain it a lot better… The first image shows the unwanted rotation, the second is the simple piping script I am using.

Posting your GH code would explain it even better.

3. Attach minimal versions of all the relevant files

Thanks Joseph. Here it is. Curves internalized.

Square Piping Orientation Help.gh (7.9 KB)


The typical solution uses Align Plane, which I added, but wasn’t sure what to align it with? So the Value List (blue group) offers three ‘ALIGN’ choices (I added one after snapping this image):

  • Line
  • HFrame
  • Z

Take your pick? Or maybe you can think of a better alignment vector?

Square Piping_2020Sep8a.gh (13.3 KB)

P.S. Here is a fourth option using the tangent vector of the curve at each point. Not quite perfect either.

Square Piping_2020Sep8b.gh (10.5 KB)

Here’s a fifth way using the negative Y vector of a Plane 3Pt for each line:

Square Piping_2020Sep8c.gh (10.8 KB)

Sleeping on the fifth method using Plane 3Pt for each pair of lines gave me an insight; if beams (“square pipes”) were coming from both sides and meeting at the ridge curve, one would expect those planes to be vertical. But the method you used to construct those three points doesn’t guarantee vertical planes, or even spacing along both curves.

So I used Crv CP to find matching points on the lower curve directly, created a line between each pair of points and moved their midpoints vertically to create a Plane 3Pt which is then used to find ridge points using PCX (Curve | Plane intersection). The beams (“square pipes”) are not aligned with the ridge curve, similar to the results in version ‘a’ when using HFrame or Z for alignment.

Square Piping_2020Sep9a.gh (19.3 KB)

A variation on this method is to use Divide Curve to find matching points on the lower curve instead of Crv CP, which spaces them evenly instead of getting bunched up.

Square Piping_2020Sep9b.gh (19.0 KB)

I added this cyan group to your original code to show that three points used to construct each pair of lines create planes (and vectors) that are not vertical, differing from Z by an average of 3.25 degrees.

Square Piping_2020Sep9c.gh (19.0 KB)

Posting a GH file with geometry is SO MUCH MORE INFORMATIVE than text and images alone!


Joseph, this is amazing. That does it. Align Z works the best for me.
You’ve always been very active helping others on the forum to learn. Thanks a lot!