sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Zoom Window Tool [REQUEST]

    Scheduled Pinned Locked Moved Plugins
    4 Posts 3 Posters 240 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JClementsJ Offline
      JClements
      last edited by

      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?

      John | Illustrator | Beaverton, Oregon

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        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?


        2014-06_76.png

        Hi

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Make a class Rect inside 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.eye

          Calculate a new target as the center of the pick rectangle:
          target = view.inputpoint(*rect.center).position

          Calulate 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 the view.vpheight by the pickrect's height to get the zoom factor to pass as the argument to view.zoom( view.vpheight / rect.height )

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Here is the non-working tool which needs the do_zoom() method filled in.

            Link Preview Image
            zoom-crosshairs-tool.rb

            GitHub Gist: instantly share code, notes, and snippets.

            favicon

            Gist (gist.github.com)

            Hi

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement