How to get the length of a curve?

I want to set my capsule object to be the exact length of the bezier curve.
How do I find out the length of the curve?
I have no idea how/what to plug the Spline Length node into.

This seems to work:

1 Like

So what is that Spline Length node used for? And if a curve has multiple splines does the Curve Length node give a sum of all of the splines instead of just one?

The Spline Length can be used the same way, since it has a Value output, I’m not sure what it does but you should be able to plug it into text and find out :slight_smile:

Thanks. Now I have other things I need to find and fix because using the exact value is too big for some reason :cry:

1 Like

I think I’ve got it done right now.

1 Like

Curve Length outputs length of ALL splines. Meanwhile Spline Length outputs for each spline of a curve… I think


It’s the sum of all the splines inside the curve object !


I think that means for text designs I’d need a different object with the geonodes for each curve in the sentence/word/letter

1 Like

How do you “use” a stored named attribute?

I’m presently dragging a noodle 3 miles across to get the curve length value over to several places where I need it.

  1. I don’t know if I’m storing it correctly here.

  2. When I try to use it in place of the duplicated nodes, I don’t get the same result.

1 Like

Note to self:

Curve spirals from addon are very jagged by default.
Need to convert spline type to Nurbs to get a smooth result.
Need to enable “endpoint” in nurbs settings to get caps to behave properly


If you want to use the attribute in the same tree, it’s easier most of the time to use a ‘capture attribute’ node. That gives you an ‘attribute’ output to use directly.

If you use ‘store named attribute’, the attribute data is stored on the geometry. So you can only use the ‘Named Attribute’ node on geometry ‘downstream’ from where you did the store. It’s not really clear from what you posted if that is what you meant, but in the first picture the ‘geometry’ output from the ‘Store Named Attribute’ node isn’t connected to anything, so the attribute isn’t actually stored on anything.

Like this? Now everything is broken, as if the value being stored is somehow very different from the value coming out of the Curve Length node.

gn-capsule-primitive.blend (134.0 KB)
giving up for today

Yes it’s broken because before you were outputting a field out of the add node,
Now you’ve plugged the Store named attribute which outputs a geometry, therefore the network is broken.

You can think of the Store Named Attribute as a “let’s create a vertex group node”, or vertex color if you use a vector rather than float.

It’s very similar to capture attribute, except that the attribute as a name and you can call it later down the line.

In your case, you might need to use transfer attribute, because on one side you have the curve (from which you get the length) and you want to apply that to the capsule ( = another object) so you need to transfer that data from one mesh to another, Store named attribute or Capture attribute is not enough.

If you need to do that for different splines within the same Curve object, you might run into a lot of issues.

A simpler way of getting a similar result from your example :
One one side, you use curve to mesh to make it a tube.
One another side, you convert your original curve with a curve to point , and keep only the first and last points ( basically the caps).
Then you instance a sphere on that , and you should have a good starting point.

Then you can refine the setup :
taking curve radius into account
orient the sphere using curve tangent ( you can use half sphere then) and finally merge the tube and the spheres.

Good Luck !

1 Like

someone in blender chat was going down that path with far more math than I can comprehend. They almost have it working but needed to sleep on it after they were like 95% there. Sometimes the half sphere still rotates away from being aligned with the edge rings of the tube while they are editing the curve, breaking the merge by distance.

I have decided to stick with my approach of merging a sphere with a cylinder and then using curve deformer.

Cool , the results are very good !

I just wanted to point out that doing the same thing is quite tricky with multiple curves.
But nothing is really smooth with geometry nodes anyway.

Things like that would be very easy with loops, probably it would be just what you did, but looped over each curves.
But for now it requires a nodal stunt to make it work ! It can be a bit frustrating !

Yeah it really pisses me off how damn close this is to programming but without loops, a mystery of nodes to get some if-else and I still can’t figure out how to save and use named attributes (variables)