Share

UserInterface.commandStarting Event

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

Description

The commandStarting event fires when a request for a command to be executed has been received but before the command is executed. Through this event, it's possible to cancel the command from being executed.

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. ---------
# "userInterface_var" is a variable referencing a UserInterface object.
# "userInterface_commandStarting" is the event handler function.
futil.add_handler(userInterface_var.commandStarting, userInterface_commandStarting, local_handlers=local_handlers)

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

Property Value

This is an event property that returns an ApplicationCommandEvent.

Version

Introduced in version November 2015

Was this information helpful?