@j.han97 .
The selection filters are only the main ones.
Two samples were created.
The first is a sample that creates a BRepBody and a CustomGraphicsBRepBody.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
def run(context):
ui: adsk.core.UserInterface = None
try:
app: adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
app.documents.add(
adsk.core.DocumentTypes.FusionDesignDocumentType
)
des: adsk.fusion.Design = app.activeProduct
des.designType = adsk.fusion.DesignTypes.ParametricDesignType
root: adsk.fusion.Component = des.rootComponent
bodies: adsk.fusion.BRepBodies = root.bRepBodies
tmpMgr: adsk.fusion.TemporaryBRepManager = adsk.fusion.TemporaryBRepManager.get()
# brep
sphere: adsk.fusion.BRepBody = tmpMgr.createSphere(
adsk.core.Point3D.create(-1,0,0),
1
)
baseFeat: adsk.fusion.BaseFeature = root.features.baseFeatures.add()
baseFeat.startEdit()
bodies.add(sphere, baseFeat)
baseFeat.finishEdit()
# CustomGraphics
sphere: adsk.fusion.BRepBody = tmpMgr.createSphere(
adsk.core.Point3D.create(1,0,0),
1
)
cgGroup: adsk.fusion.CustomGraphicsGroup = root.customGraphicsGroups.add()
cgBody:adsk.fusion.CustomGraphicsBRepBody = cgGroup.addBRepBody(sphere)
cgBody.color = adsk.fusion.CustomGraphicsBasicMaterialColorEffect.create(
adsk.core.Color.create(0, 255, 0,255),
adsk.core.Color.create(255, 255, 0, 255),
adsk.core.Color.create(0, 0, 255, 255),
adsk.core.Color.create(0, 0, 0, 255),
10,
0.5
)
app.activeViewport.fit()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Then, a sample selection filter that only allows CustomGraphicsBRepBody.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
_app: adsk.core.Application = None
_ui: adsk.core.UserInterface = None
_handlers = []
def run(context):
try:
global _app, _ui
_app = adsk.core.Application.get()
_ui = _app.userInterface
cmdDef: adsk.core.CommandDefinition = _ui.commandDefinitions.itemById(
'test_cmd_id'
)
if not cmdDef:
cmdDef = _ui.commandDefinitions.addButtonDefinition(
'test_cmd_id',
'test',
'test'
)
global _handlers
onCommandCreated = MyCommandCreatedHandler()
cmdDef.commandCreated.add(onCommandCreated)
_handlers.append(onCommandCreated)
cmdDef.execute()
adsk.autoTerminate(False)
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
class MyPreSelectHandler(adsk.core.SelectionEventHandler):
def __init__(self):
super().__init__()
def notify(self, args: adsk.core.SelectionEventArgs):
adsk.core.Application.get().log(args.firingEvent.name)
# Selection of the element under the mouse cursor.
sel: adsk.core.Selection = args.selection
ent = sel.entity
# Filtering by classType.
if ent.classType() != adsk.fusion.CustomGraphicsBRepBody.classType():
# If not CustomGraphicsBRepBody, disallow selection.
args.isSelectable = False
class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
def __init__(self):
super().__init__()
def notify(self, args: adsk.core.CommandCreatedEventArgs):
adsk.core.Application.get().log(args.firingEvent.name)
try:
global _handlers
cmd: adsk.core.Command = adsk.core.Command.cast(args.command)
# cmd.isOKButtonVisible = False
# event
onDestroy = MyCommandDestroyHandler()
cmd.destroy.add(onDestroy)
_handlers.append(onDestroy)
onPreSelect = MyPreSelectHandler()
cmd.preSelect.add(onPreSelect)
_handlers.append(onPreSelect)
# inputs
inputs: adsk.core.CommandInputs = cmd.commandInputs
selIpt: adsk.core.SelectionCommandInput = inputs.addSelectionInput(
'selIpt',
'select',
'select'
)
# No filters are set here.
except:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
class MyCommandDestroyHandler(adsk.core.CommandEventHandler):
def __init__(self):
super().__init__()
def notify(self, args: adsk.core.CommandEventArgs):
adsk.core.Application.get().log(args.firingEvent.name)
adsk.terminate()
Create a SelectionCommandInput in MyCommandCreatedHandler, but do not specify a selection filter.
Instead, the selection permission is determined within MyPreSelectHandler.
This method requires a dialog and is not available in the UserInterface.selectEntity method.