Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Due to security concern my team should not upload sensitive data to cloud storage. Therefore I wrote an add-in to monitor the Application.documentSaving event. According to the documentation,
'You can set the isSaveCanceled property of DocumentEventArgs to true to cancel the document save.'
But when I test this add-in, the saving process is not interrupted at all. The problem is, there is no 'isSaveCanceled' property in both the documentation and the code hint in VSCode.
The sample add-in is posted below. Your help is highly appreciated!
#Author-
#Description-This add-in is used to disable upload/saving any file to Fusion 360 cloud server
import adsk.core, adsk.fusion, adsk.cam, traceback
class documentSavingEventHandler(adsk.core.DocumentEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
_app.log('Detected document saving')
eventArgs = adsk.core.DocumentEventArgs.cast(args)
#Tried with/without firingEvent
##eventArgs.firingEvent.isSaveCanceled = True
eventArgs.isSaveCanceled = True
_app: adsk.core.Application = adsk.core.Application.get()
_ui: adsk.core.UserInterface = _app.userInterface
_handlers = []
def run(context):
try:
_app.log('Addin is running')
onDocumentSaving = documentSavingEventHandler()
_app.documentSaving.add(onDocumentSaving)
_handlers.append(onDocumentSaving)
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def stop(context):
try:
_app.log('Stop addin')
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.