# How to calculate the distance between vertices couples and show it as text

I wish to create a function using geometry nodes that calculates the distance between consecutive vertices of a mesh, and adds text depicting the calculated distance between each pair of vertices, exactly at the center of the segment they form. I imagine I need to convert the mesh into a curve first, use the 'Geometry Proximity' node somehow, and also use the 'Value to String' and 'String to Curve' nodes... But this should be done in a loop, probably using fields, for every pair of vertex. I'm not sure how to proceed, normally I would include an example file, but I haven't been able to put together anything that makes sense. How should I go about this?

## 2 Answers

That can be optimised a bit if we only use the 11 needed base instances (meaning number from 0 to 9 and the dot).

The principle is the same:

Calculate edge lengths.

Iterate over the edges and sample lengths and positions.

Place instances calculated from the length at the edge position.

Now instances are first made from the "0123456789." text.

Its an iteration again, over the given text so that we create one text curve per character.

Then, another iteration from the length converted to text in order to associate the length text from the instances created above.

Result on a subdivided Suzanne:

(Blender 4.0)

• +1 really nicer solution! Commented Jan 25 at 11:37
• Thank you, I really appreciated the feature that makes the text size proportional to the edge lengths, moreover, it was my intention to include it from the beginning but I did not specify it to avoid unnecessarily complicating the question and to get straight to the point. This was exactly what I needed. I was surprised to see how using more nodes makes the node tree more efficient; I would have expected the opposite, although I understand that this approach in the algorithm allows for saving on processing Commented Jan 25 at 17:58

with this node setup:

you get this:

Note: Try this out with a simple geometry. It is for sure not the fastest solution, so for suzanne it can take a while

Note2: I recommend using a vertex group or another limiting factor so that you show only "a few" distances for performance reasons.

• Thanks, I manually recreated your node tree to learn and to better understand @lemon modifications. It worked perfectly, but when I tried the optimized solution from lemon I saw how much faster it is on my computer, and I am going to accept his answer because of this. Thanks very much for your time and for what you teached me and everyone Commented Jan 25 at 17:53