Share

Application.documentOpening Event

Parent Object: Application
Defined in namespace "adsk::core" and the header file is <Core/Application/Application.h>

Description

The DocumentOpening event fires at the VERY start of a document being opened. There is no promise that the document will be opened, hence a documentOpened event may not follow.

When a document is being opened that references other documents, only the top-level document will cause a documentOpening event to be fired.

Syntax

-------- Import ---------
# Import fusion360utils folder, which includes event_utils.py.
from ...lib import fusion360utils as futil

-------- Global variables ---------
# Global variable used to maintain a reference to all event handlers.
local_handlers = []

-------- Connect the handler to the event. ---------
# "application_var" is a variable referencing an Application object.
# "application_documentOpening" is the event handler function.
futil.add_handler(application_var.documentOpening, application_documentOpening, local_handlers=local_handlers)

-------- Event handler function definition ---------
# Event handler for the documentOpening event.
def application_documentOpening(args: adsk.core.DocumentEventArgs):
# Code to react to the event.
app.log('In application_documentOpening event handler.')

Property Value

This is an event property that returns a DocumentEvent.

Version

Introduced in version August 2014

Was this information helpful?