How to unify the direction (Tangent direction) of the curve?

How to unify the direction (Tangent direction) of the curve, so that the size and face orientation of each window frame are the same after the curve transferred to mesh?

ps:The above is the provided blender file. After the mesh is converted to a curve, the direction of the curve is chaotic. The question I'm asking is how can I unify the direction of all the curves.All curves are rotated counterclockwise relative to the mesh face normal.

Basically, you did everything right, but since the indices of your mesh are pretty messed up, the alignment of your curves is also messed up.

However, you can use a trick to straighten everything out:

1. Use the node Extrude Mesh with an offset of $$0$$. This will create additional faces.
2. Split the edges of the top faces with the node Split Edges.
3. Remove the superfluous faces created by the extrusion with the node Delete Geometry.
4. And then you can apply the remaining nodes as before, because with this all curves have a correct orientation.

Depending on the direction of your profile curve, you may need to add the Flip Faces node at the end to correct the direction.

Update

In your particular case, however, everything is obviously messed up, which is why the above solution doesn't work (as you yourself noted).

Therefore, you really need to correct the alignment of the curves beforehand.

To solve this you have to take the more complicated route and look more closely at the alignment of the individual segments of the curves, and then make the appropriate corrections.

In principle, you could solve part of the problem here with the node Reverse Curve, but unfortunately this simply reverses the direction of the points.

So to actually get a correct alignment of the curves, you would have to affect the Curve Tilt, and then correct the alignment of the normals on the generated mesh.

Variant 1

With this solution, I first look at the alignment of the individual segments of the splines, and use that to decide whether or not to rotate the Curve Tilt:

All in all, however, this is rather unnecessary work, because as I could now see in your file, you wanted to do something completely different anyway.

At least it is obvious in the file that you somehow wanted to create an extruded window frame.

If that's the case, you can actually solve this much easier, and the whole question as well as this extensive answer was totally superfluous.

So here are the simple solutions to your actual problem:

Variant 2

Simple extrusion of the mesh:

Variant 3

Solid extrusion of the mesh:

Variant 4

Curve to mesh with a closed profile (Thanks to @RobinBetts):

Here is the blend file you provided, which includes all four variants. ...choose the one that suits you best:

• @tallien1212 OK, that really looks like a bug though, and I honestly don't know why it works on my mesh and not yours. If I were you, I would just use my mesh. The curves in your example really do what they want, and don't follow any logical pattern. And aligning the curves on the basis of their tangents is also not enough, because Mesh to Curve also sets arbitrary starting points here. Jun 30 at 8:33