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`
Advertisement