Rotate Current View 2D about Screen Z (Ruby solution)
-
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_viewNab existing eye and target objects
eye = view.camera.eye
target = view.camera.targetDefine 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.0Set new camera components
newCamera.set eye, target, up
Apply new view
status = view.camera=newCamera`
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement