Hi @amoldshelke .
If you want to use the API to control it at the same time, you can do so by changing the Viewport.camera property.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2005e69c-36cd-45a2-bb3d-8cf5b968ab9a
This sample script also zooms while circling around from the state in which it was executed.
# Fusion360API Python script
import adsk.core, adsk.fusion, adsk.cam, traceback
import math, random
# Number of divisions during one revolution
COUNT = 11
def run(context):
ui = None
try:
app: adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
# get state
vi :adsk.core.Viewport = app.activeViewport
camera :adsk.core.Camera = vi.camera #This is a deep copy.
eye :adsk.core.Point3D = camera.eye
tgt :adsk.core.Point3D = camera.target
up :adsk.core.Vector3D = camera.upVector
baseArea = camera.viewExtents
# get matrix
front :adsk.core.Vector3D = eye.vectorTo(tgt)
right :adsk.core.Vector3D = up.copy()
right.crossProduct(front)
mat :adsk.core.Matrix3D = adsk.core.Matrix3D.create()
mat.setWithCoordinateSystem(tgt, right, front, up)
# get position & ratio
unit = math.radians(360 // COUNT)
rads = [unit] * COUNT
ratios = [random.uniform(0.1, 5.0) for _ in range(COUNT)]
if 360 % COUNT != 0:
rads.append(math.radians(360 % COUNT))
ratios.append(1)
# show
camera.isSmoothTransition = True
for rad, ratio in zip(rads, ratios):
mat.setToRotation(rad, up, tgt)
eye.transformBy(mat)
camera.eye = eye
zoom = baseArea * ratio
camera.viewExtents = zoom
vi.camera = camera
vi.refresh()
adsk.doEvents()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
However, I think it would be difficult to create an add-in to perform Zoom and orbit with GUI keystrokes.
The Fusion360 API also supports keyboard events, but it is not very responsive.
If you use the OS API, it may be possible.
If you simply want to create an animation, I recommend you to use the Animation Workspace.