- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The description of the cameraChanged event states (emphasis mine):
The cameraChanged event fires immediately after a change in the camera has been made. Camera changes happen when user changes the view by rotating, zooming in or out, panning, changing from parallel to perspective, or when the extents of the viewport changes.
However, I have observed that no event is fired when the viewport is resized, by either resizing the main window or opening/closing the data panel. Selecting "Multiple views" sometimes fire cameraChanged (try toggling back and forth a few times).
I expect the cameraChanged event to fire every time the/a viewport changes size on the screen.
The meaning of "extents" is not fully clear to me. If it is intended to mean that the view changes the size of the opening "into" model space, the event should at least trigger if the view proportions are changed. If I draw a rectangle covering the view fully and resize the main window, I see that the rectangle does not continue to touch both the sides and top/bottom of the view port, as what is seen is scaled without changing its proportions.
Example code (create the sample add-in and replace the contents of the main file). It will log in the console every time a cameraChanged event is fired.
# Assuming you have not changed the general structure of the template no modification is needed in this file.
# from . import commands
from .lib import fusionAddInUtils as futil
import adsk.core
from datetime import datetime
app = adsk.core.Application.get()
def run(context):
try:
# This will run the start function in each of your commands as defined in commands/__init__.py
# commands.start()
futil.add_handler(app.cameraChanged, cameraChanged)
except:
futil.handle_error('run')
counter = 0
def cameraChanged(args: adsk.core.CameraEventArgs):
global counter
counter += 1
app.log(f"{datetime.now()} Camera changed {counter}")
def stop(context):
try:
# Remove all of the event handlers your app has created
futil.clear_handlers()
# This will run the start function in each of your commands as defined in commands/__init__.py
# commands.stop()
except:
futil.handle_error('stop')
My Add-ins (Windows)
⌨️ Toolbar & Shortcuts Editor: Assign any key (and some mouse buttons) as keyboard shortcut!
⤴️ Extra Shortcuts: Assign shortcut to Front, Home view, Look At, Activate Component and more!
⭐ My Logo: Put your logo in the Fusion window (for presentations and streaming)
Axalea Notes - Annotate your model with notes
Solved! Go to Solution.