sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Rotate Current View 2D about Screen Z (Ruby solution)

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 161 Views 1 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.
    • G Offline
      Gruff
      last edited by

      Okay I think I can attempt my first Ruby plugin with a little help.

      I'm thinking that if I can get two points selected on screen and get the vector between them I can adjust my code below to rotate the SU view to a rotation about screen z.

      Can someone give me a hand?

      ` model = Sketchup.active_model
      view = model.active_view

      Nab existing eye and target objects

      eye = view.camera.eye
      target = view.camera.target

      Define a new camera object

      newCamera = Sketchup::Camera.new

      up = newCamera.up

      Redfine Up vector, ignoring z (Last array element)

      This should rotate the view about the screen center

      Values should range from -1.0 tp 1.0 each I would imagine

      up[0] = 1.0
      up[1] = 1.0
      up[2] = 0.0

      Set new camera components

      newCamera.set eye, target, up

      Apply new view

      status = view.camera=newCamera`

      Resistance is .... Character Forming. Grin

      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