1
$\begingroup$

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?

$\endgroup$

2 Answers 2

6
$\begingroup$

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.

enter image description here

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.

enter image description here

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

enter image description here

Result on a subdivided Suzanne:

enter image description here

(Blender 4.0)

$\endgroup$
2
  • 2
    $\begingroup$ +1 really nicer solution! $\endgroup$
    – Chris
    Jan 25 at 11:37
  • 1
    $\begingroup$ 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 $\endgroup$
    – crucchi
    Jan 25 at 17:58
3
$\begingroup$

with this node setup:

enter image description here

you get this:

enter image description here

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.

$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$
    – crucchi
    Jan 25 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .