Cool, thanks. Love it when I can know how far away something is in a model.
@al hart said:
I took the utilitiestools.rb script in SketchUp, which displays an X,Y location as you move the mouse and changed it to display the distance from the camera instead.
[attachment=1:2q0r3qa8]<!-- ia1 -->get_focal_length.jpg<!-- ia1 -->[/attachment:2q0r3qa8]
The heart of the change is this routine to display the camera distance:
> # get camera distance from the eye to a point at (x,y,0)
> def get_distance(target)
> model = Sketchup.active_model
> eye = model.active_view.camera.eye
> distance = eye.distance(target)
> # display in drawing units and inches
> slength = Sketchup.format_length(distance) + sprintf(" (%g\")", distance)
> return slength
> end#def
>
Try the attached script: get_camera_distance.rb
[Edit: I uploaded a new version of get_camera_distance.rb]