Zoom Window Tool [REQUEST]
-
Is there a way to replace SU's native Zoom Window Tool with a new graphic which is a crosshair so that the starting corner of the tool can be accurately placed?
OR
Could a script create a tool identical to the functioning of the native SU Zoom Window Tool which uses a cross hair graphic?
-
Entirely possible - I have the code already to make the selection with cross-hairs. Just need help calculating where to move the camera. Ideas, anyone?

-
Make a class
Rectinside your tool class (which is instantiated with the picked rectangle.)
Have instance methods return it's height and center (in screen pixels.)Save a ref to the current camera eye:
cam = view.camera eye = cam.eyeCalculate a new target as the center of the pick rectangle:
target = view.inputpoint(*rect.center).positionCalulate the new up vector from the directional vector
dir_vec = eye.vector_to(target) up = ? # use trig ?Set the camera:
view.camera.set( eye, target, up )Set the zoom factor, by:
dividing theview.vpheightby the pickrect's height to get the zoom factor to pass as the argument toview.zoom( view.vpheight / rect.height ) -
Here is the non-working tool which needs the
do_zoom()method filled in.
zoom-crosshairs-tool.rb
GitHub Gist: instantly share code, notes, and snippets.
Gist (gist.github.com)
Advertisement