You can do a linepick and get the picked x, y, and z positions (along with the normal of the picked object), from which you can work out essentially the same thing.
so it would actually be something like,
obviously you need a 3d distance function but I'm sure you can work that one out :)
so it would actually be something like,
rangePick(EntityNo,srcX#,srcY#,srcZ#,lenX#,lenY#,lenZ#) vectorLength#=3ddistance(srcx#,srcy#,srcz#,pickedx(),pickedy(),pickedz())
obviously you need a 3d distance function but I'm sure you can work that one out :)