Hi @k.kaluza .
If you want to make strict selection criteria, the selection filter is not enough.
Therefore, I think it is possible to set the desired conditions by using PreSelect Event and PreSelectMouseMove Event.
http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-0550963a-ff63-4183-b0a7-a1bf0c99f821
I made a sample to select only arc edges and sketches in PreSelect Event without using selection filter.
#Fusion360API Python script
#Author-kantoku
#Description-Select Event Sample
import adsk.core, adsk.fusion, traceback
_commandId = 'SelectionEvent'
_SelIpt1ID = 'Selectioninput1'
_handlers = []
_app = None
_ui = None
# https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E3D24F04-8576-420E-B9AD-44746A6B12EE
class PreSelectHandler(adsk.core.SelectionEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
args = adsk.core.SelectionEventArgs.cast(args)
# Temporarily disable the entity selection
args.isSelectable = False
# Get entity on mouse cursor
sel :adsk.core.Selection = args.selection
ent = sel.entity
# Find out if you meet the requirements of your selection
if not hasattr(ent, 'geometry'):
return
if ent.geometry.objectType == 'adsk::core::Circle3D':
# Since the condition is met, selectable
args.isSelectable = True
class CommandDestroyHandler(adsk.core.CommandEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
try:
adsk.terminate()
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
# Event handler for the select event.
# https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2ACFFC2F-458B-4740-93B8-CCC56638D8AA
class MySelectHandler(adsk.core.SelectionEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
eventArgs = adsk.core.SelectionEventArgs.cast(args)
# Code to react to the event.
_ui.messageBox('In MySelectHandler event handler.')
class CommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
try:
cmd :adsk.core.Command = args.command
onDestroy = CommandDestroyHandler()
cmd.destroy.add(onDestroy)
_handlers.append(onDestroy)
onPreSelect = PreSelectHandler()
cmd.preSelect.add(onPreSelect)
_handlers.append(onPreSelect)
onSelect = MySelectHandler()
cmd.select.add(onSelect)
_handlers.append(onSelect)
inputs = cmd.commandInputs
i1 = inputs.addSelectionInput(_SelIpt1ID, _SelIpt1ID, _SelIpt1ID)
i1.setSelectionLimits(0)
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def run(context):
try:
global _app, _ui
_app = adsk.core.Application.get()
_ui = _app.userInterface
cmdDefs = _ui.commandDefinitions
cmdDef = cmdDefs.itemById(_commandId)
if cmdDef:
cmdDef.deleteMe()
cmdDef = cmdDefs.addButtonDefinition(_commandId, _commandId, _commandId)
onCmdCreated = CommandCreatedHandler()
cmdDef.commandCreated.add(onCmdCreated)
_handlers.append(onCmdCreated)
cmdDef.execute()
adsk.autoTerminate(False)
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
I hope it will be useful.