How to use SetCameraDirection?

I made 3 test commands TestA, TestB and TestC


RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.SetCameraDirection(New Rhino.Geometry.Vector3d(New Rhino.Geometry.Point3d(10, 0, 0)), False)


RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.SetCameraDirection(New Rhino.Geometry.Vector3d(New Rhino.Geometry.Point3d(0, 0, -10)), False)


RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.SetCameraDirection(New Rhino.Geometry.Vector3d(New Rhino.Geometry.Point3d(0, 0, 10)), False)
RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.Rotate(180, New Rhino.Geometry.Vector3d(10, 0, 0), New Rhino.Geometry.Point3d(0, 0, 0))

When I play around TestB result will be different most of the times. So I TestA then TestB gives a result but when I TestC and then TestB will give a different result. How come?

Hi Jordy,

You did not set the CameraLocation, so it might be that a its default version has been used. That in conjunction with SetCameraDirection you defined, could cause some confusion.
Try this:

import rhinoscriptsyntax as rs
import scriptcontext as sc

vecStart = rs.GetPoint("pick the starting vector point")
vecEnd = rs.GetPoint("pick the ending vector point")

rv = sc.doc.Views.ActiveView.ActiveViewport
rv.SetCameraLocation(vecStart, False)
rv.SetCameraDirection(rs.VectorCreate(vecEnd, vecStart), True)

Also, rotation angles should be specified in radians, not degrees…

Yeah got that one figured out now Thanks. So I can rotate it but is it also possible too use one of the presets like Top Bottom left Right?

Try using RhinoViewport.SetProjection.

Oke the combinations of SetProjection and my previous post did exactly what I wanted to! Thanks @djordje and @dale.