Measure Distance Between Two Locations(Rendered)

Hey Blender Artists,

I´am searching for a way to measure various distances and if I render the Scene it should also be rendered. In basic something simple like this:

I´ve no problems with Blenders Unit system or to get the distance between two Verts just looking for a way to display distance between point A & B and not doing it every time by hand.

Thanks Polygonaut

This is a quick mockup of your effect. It measures the 3-d distance. You have two empties for the start end end positions, and a text object to display the distance. Move the empties where you want them, and then in the text editor click ‘run script’ The text object will then be updated to display the distance. I have parented the text object and a white rectangle to the camera so that it will always be parallel to the camera. Now if you want the distance to be updated dynamically when you move an empty (without having to click ‘run script’ There’s a few extra things you’d need to do. I’ll post my blend if you want to look at it. If it’s what you’re looking for I can tell you how to incorporate it into your scene.
distance.blend (557 KB)



and the code:


import bpy
import math


def getDistance(p0, p1):
    return math.sqrt((p0[0] - p1[0])**2 + (p0[1] - p1[1])**2  + (p0[2] - p1[2])**2)

start = (bpy.data.objects['Empty.start'].location.x , bpy.data.objects['Empty.start'].location.y , bpy.data.objects['Empty.start'].location.z)
end =( bpy.data.objects['Empty.end'].location.x , bpy.data.objects['Empty.end'].location.y , bpy.data.objects['Empty.end'].location.z)

distance = getDistance(start,end)

distancestring = str("%.3f" % distance) #ROUND THE NUMBER TO 3 DECIMAL PLACES
bpy.data.objects["Text.distance"].data.body = distancestring

*** Disclosure: I copied the distance function from here and added the third dimension. The rest of the code is mine.

First of all thank you blenderallday for the time you invested to create this mostly form scratch for me :slight_smile:
I´ve downloaded the blend and it is pretty close to what I was searching for, the only thing that I´am missing is the connection between A and B(the red line in the posted ref picture). Since I can´t code I don´t know how much additional work and time is needed to have something like a procedural mesh that visualizes the distance between A & B on the rendered picture.

As I mentioned above I can´t code, but I can create 2D and 3D art. If you like to help me with the code I can create the 2D & 3D stuff to bring this to life.

@gexwing
@LarryPhillips

Super Awesome! This addon is ecxactly what I was searching for, works like a charm.

Thanks,
Polygonaut

Photox, thank you for this. I am actually interested in know how to update the distance dynamically. Would you please help me with this? I want it to update when I move the empties, because it is not an animation. Thanks!

one of the measure script already has a function to change scale to get
real values
but don’t remember which one!

happy bl