the orientation of the rectangular profile should be the same in all bents

Right now I make perp frames on the arc, shift them and use the y vector’s average to determine the rotation of the straight parts. But this is not enough, as you can see in the left, it does not work with all transitions (8 and 9, 3 and 2). It should look a bit like on the right (I rotated this one manually).

So I guess, I have to use the neighboring straight part swell to affect the rotation, but I don’t have any clue on how to do so.
I would be super thankful for better approaches to my problem.

This thread looks and sounds very similar to one by @Carlotta five days ago - coincidence? I think not because even the group color and style is the same.

No, absolutely no coincidence, we work on the same project in art college Berlin. =)

We avoid sweeping it all at once now. Instead we loft and sweep the segments individually, which works well!

When using Sweep with one closed curve with one section, as you suggested in the other post, the orientation of the rectangular profile changes and the straight parts are twisted.

Any idea on how we could optimize the rotation to make it smoother avoid the twist?

@Joseph_Oster I can’t seem to make a single Sweep1 work consistently on those curves…

As for the original problem, after an overdose of math I think I came to a satisfactory solution, composed of three steps.
First, keeping the average vector approach as a “fixed” orientation for the straight parts, I simply aligned vectors based on their dot product. This is because if you have two arcs going in opposite directions, their normal vectors will be (almost) opposite, which will result in a ~90 degree rotation that can be avoided.

Second, due to this 180 degree flip possibility, I tested the correct orientation of the sections for the sweep1 along the arcs, keeping the solution where the length of lines connecting vertices of the two sections is the smallest.

And third, and this is where I’m gonna lose everyone, taking the average vector for the straight parts is the (exact) solution to a minimization problem that only involves the direction of a straight part, compared to the directions of the arcs before and after. This is not including a goal of minimization of the minimal torsion along the arcs as well. Deriving the equations, computing the matrix, solving the system… gives a solution which I feel is smoother but… it’s getting late so this could be completely wrong. You can “disable” this by setting k=0.

We are sorry for the duplicate thread, feel free to delete the older one!

Thanks for taking the time to look at our file.
As written in the first post of this thread, I corrected the straight parts manually to give an example on how it should look. There is a stream filter that turns manual correction on/off. It’s turned on, that’s why it looks ok when you open the file.

@magicteddy , thank you very much. We, ve been trying to solve this for two days. It made me super angry. Haha.
I just tried your file with different curves and as far as I can see it works perfectly. I will work through it today to understand what you did.

Thanks again for taking the time to solve our problem!!

I’ve had the time to look at this now and believe it’s much ado about nothing. My reply in the other thread about using just one section curve was very close to the truth.

After much experimentation, I find this morning is that one section curve works fine except for a twist at the very end. I don’t know what you and @magicteddy did to fix this? In the end, I used a separate sweep on the last section (yellow) that minimizes the twist, but it’s still there and I don’t see how it can be avoided? All the straight sections have no twist except for that last one.

Here is a hasty gimmick that spreads out the twist angle in the yellow section (13.244 degrees by eye) over all the curves. It uses Range and MA(‘Pr’ output) to nudge the frames (rectangle sections) of all the straight sections. Looks good, eh?

Hello Jospeh,
I worked through you file this morning and I like it very much. Thank you!
I like the way you used perp frame on the closed prep, instead of using it only on the arcs that way you don’t need to determine the average vector. Also the distributing of the twist on all the other straight parts works very well.

I didn’t understand your file completely (I still don’t) I must admit I watched some basic tutorials on vectors to understand how you used dot product to check and correct rotation. Very nice!

I feel it looks better with k enabled. Although some bents seem a bit stretched. We have to see how it will affect the actual wood-bend.

Laminating thin layers? You know, of course, that the Rectangle ‘X’ and ‘Y’ inputs can be swapped to effectively rotate the “flat bar” 90 degrees, if that helps. But the random curve is indiscriminate about which orientation is easier to make.

In fact, I suppose all the planes used to make the rectangles could be rotated by the same value to orient the final result any way you want. (orange group)

Yes, we will use lamination method for bending, probably witch additional steaming. But only the bends will be cut (hopefully with our uni robot). Thats why the straight part can’t be twisted.

I would expect the lamination layers to be visible on only two opposite sides, not all four? Building this will be difficult, especially if the straight sections are solid pieces with scarf joints at the curves.

That was our first idea, sweep the section as it comes and align only the lamination with the arc. In this thread’s file we align the section so that the lamination will be visible only on two sides.

I’m concerned about how this sculpture gets assembled.

This white group, above the canvas, is a rather elaborate effort to create blocks that encompass the curves - with the idea that a CNC machine can be used to carve away the blocks leaving the curves.

It worries me a little that three sliders are used to adjust parameters… but otherwise, it’s cool? All the blocks are the same thickness and chopped to have edge surfaces that are square to the straight sections connecting them.

I won’t count the hours spent on understanding why this intuitive solution was giving better results, but eventually I did. As a minimization problem, it turns out the first two goals are absolutely unnecessary. Keeping only the “minimum torsion along each arc” goal, and correcting a mistake in angle evaluation AT LAST outputs the same solution - or, I should say the same base solution, as one could add a constant angle to all sections and it would still work.

Moral of the day : think before diving into n*n matrices.

Second moral of the day : Perp Frame component does NOT output the same plane as RhinoCommon method Curve.PerpendicularFrameAt

@maj For future readers, the solution should therefore be Joseph’s post, not mine.