• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

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

Scheduled Pinned Locked Moved Developers' Forum
1 Posts 1 Posters 143 Views
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 26 Oct 2009, 19:48

    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
    1 / 1
    • First post
      1/1
      Last post
    Buy SketchPlus
    Buy SUbD
    Buy WrapR
    Buy eBook
    Buy Modelur
    Buy Vertex Tools
    Buy SketchCuisine
    Buy FormFonts

    Advertisement