Message 1 of 3

Not applicable
12-13-2019
11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having an issue with the TableCommandInput in the Python API not displaying correctly when it has more than one row and a toolbarCommandInput. I have confirmed on the API forum that the code is working correctly for other people.
I am on:
MacOS 10.15.2
Fusion 2.0.7036
#Fusion360API Python script import adsk.core, adsk.fusion, traceback _ui = None _handlers = [] class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler): def __init__(self): super().__init__() def notify(self, args): try: cmd = adsk.core.Command.cast(args.command) inputs = cmd.commandInputs onDestroy = MyCommandDestroyHandler() cmd.destroy.add(onDestroy) _handlers.append(onDestroy) table = inputs.addTableCommandInput('table', '', 4, "") for i in range(4): for j in range(4): ci = table.commandInputs.addTextBoxCommandInput("tb{}{}".format(i, j), "", "{} . {}".format(i, j), 1, True) table.addCommandInput(ci, i, j) button = table.commandInputs.addBoolValueInput('button', 'Button', False, '', True) table.addToolbarCommandInput(button) except: _ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) class MyCommandDestroyHandler(adsk.core.CommandEventHandler): def __init__(self): super().__init__() def notify(self, args): try: adsk.terminate() except: _ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def run(context): try: app = adsk.core.Application.get() global _ui _ui = app.userInterface cmdDef = _ui.commandDefinitions.itemById('table_test') if cmdDef: cmdDef.deleteMe() cmdDef = _ui.commandDefinitions.addButtonDefinition('table_test', 'table_test', 'table_test') 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()))
Solved! Go to Solution.