Find focal distance

Is there a quick way to find the focal distance from the camera to any selected point without having to display the camera in another viewport and measure it manually. I’d like to simply snap to a point in my view and get the distance from the camera.
It would be nice to have this hability so that I can quickly set the area in focus for the DOF in vray or any other renderer.
Maybe a script ? RhinoScriptSyntax has a ‘viewcamera’ variable that gives the current location of the camera …

Hi Juan - see how this script works for you - Save, then drag and drop it onto Rhino to add these aliases:
CameraDistance - distance from the camera eye point to a user selected point
TargetDistance - distance from the camera eye point to the camera target.

CameraDistance.rvb (664 Bytes)

-Pascal

Cool thanks. CameraDistance works but TargetDistance doesn’t …

Hmm - works here - what happens for you? anything? or an error, or?

-Pascal

Unknown command TargetDistance …

I found the error. There was an extra space in the alias definition so it wasn’t defining it.
Works now. Thanks again.