# Geometry nodes: Curve caps horizontal

In Geometry Nodes, I create 2 spirals, then using Curve to Mesh with a simple plane and Fill Caps to true, I get this (showing just the top of the spirals here):

Now, I would like the caps to be horizontal, like so:

Can it be done? (using Geometry Nodes of course)

I didn't test this solution thoroughly, but the principle is sound at least... Take the z difference to desired height, calculate the ratio of tangent's z component to that desired z difference and scale the tangent to make its z component exactly the desired z difference.

How is this z difference calculated? Well that's "topology nodes" shenanigans: for each point take the neighboring face which is a cap (caps are marked sharp, so I use sharp_face attribute). For that face take the top/bottom corner depending on captured endpoint attribute - this is why I use a switch to decide if I want the first or last face corner sorted by height.

Blend 4.2

• Is this free !? :D I mean, it is just so great that people ( like you ) take the time to help others. Thank you so much, I plugged this in and it worked like a charm .... I don't understand why it works yet, but I will examine and learn. Commented Sep 5 at 7:21

The Node Curve to Mesh does not offer a direct way to align the face caps according to your wishes, so you would have to modify the caps accordingly after converting the curves into a mesh.

The Raycast node will help you with this.

It's something like this:

First, capture the Endpoint and the Curve Tangent on the (resampled) curve. These values are adopted in the geometry when using Curve to Mesh and can then be further processed.

Then separate the top face using this selection and apply the Bounding Box node to it. This will give you a box that is horizontally aligned and completely encloses the face.

By subsequently separating the uppermost face from this box by comparing the face normals and scaling it up a little, you get a plane that you can use as a limit for moving the end points.

Finally, apply the Raycast node and use the previously saved Curve Tangent as the Ray Direction.

(Blender 4.2.0+)

• Thank you so much ! I plugged it in and I had some trouble with it, where it sometimes behaved in an unexpected way. But I am sure it needs just a minor change .... but to be honest, I don't understand half of what you are doing there, so I will take some time now to understand and learn. Again, thank you ! Commented Sep 5 at 7:19