@Hi @isocam .
If it is an add-in rather than a script, it is possible to monitor that the command to create the component is executed.
Try this by creating a new add-in.
#FusionAPI_python addin
import adsk.core, adsk.fusion, traceback
handlers = []
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
onCommandTerminated = MyCommandTerminatedHandler()
ui.commandTerminated.add(onCommandTerminated)
handlers.append(onCommandTerminated)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def stop(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
ui.messageBox('Stop addin')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
# Event handler for the commandTerminated event.
class MyCommandTerminatedHandler(adsk.core.ApplicationCommandEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
ui = None
try:
eventArgs = adsk.core.ApplicationCommandEventArgs.cast(args)
app = adsk.core.Application.get()
ui = app.userInterface
newCompCmds =[
'FusionCreateNewComponentCommand',
'FusionCreateNewCompCmdFromBody']
if eventArgs.commandId in newCompCmds:
# Add the process you want to perform
ui.messageBox('Catch New Component')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))