Or you can use an expression to get the value and add it to a custom attribute.
For example
CODE
vector $p1 = <>;
vector $p2 = <>;
vector $diff = ( $p1 - $p2 );
float $distance = sqrt( dot( $diff, $diff ) );
object.customAttr = $distance;
getAttr object.customAttr;
Or you could do the same thing with linking together nodes. If of course you have trouble with distance dimension. Which I also have had in the past. Should not be to heavy on your scene either.
cheers