Share

Command.preSelectStart Event

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

Description

As the mouse moves over entities in the graphics window, entities valid for selection are highlighted. Before an entity is highlighted, Fusion determines if it is a valid selectable entity using the selection filter defined on the SelectionCommandInput and the preSelect event of the command. The preSelectStart event fires when the mouse first moves over an entity valid for selection. You can obtain the entity and mouse position from the Selection object returned by the selection property of the SelectionEventArgs object provided through the event.

Some related events are the preSelectMouseMove event, which fires as the mouse moves across the entity, and the preSelectEnd event, which fires when the mouse moves off the entity.

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. ---------
# "command_var" is a variable referencing a Command object.
# "command_preSelectStart" is the event handler function.
futil.add_handler(command_var.preSelectStart, command_preSelectStart, local_handlers=local_handlers)

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

Property Value

This is an event property that returns a SelectionEvent.

Version

Introduced in version May 2022

Was this information helpful?