Skip to content

Instantly share code, notes, and snippets.

@smoofra
Created April 12, 2019 22:38
Show Gist options
  • Save smoofra/8d3088b31a9cb6b587835af08a4ad854 to your computer and use it in GitHub Desktop.
Save smoofra/8d3088b31a9cb6b587835af08a4ad854 to your computer and use it in GitHub Desktop.
Fusion360: orbit the camera around the target point by 90 degrees
import adsk.core, adsk.fusion, adsk.cam, traceback
from adsk.core import *
from math import pi
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
view = app.activeViewport
camera = view.camera
rot = Matrix3D.create();
rot.setToRotation(2 * pi / 360 * 90, camera.upVector, camera.target)
eye = camera.eye
eye.transformBy(rot)
camera.eye = eye
view.camera = camera
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment