Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When GroupCommandInput.isEnabledCheckBoxDisplayed is set to True, despite the expected behavior, isEnabled property will always be True regardless of the group command input checkbox state. isEnabled property will be false only when we set it to false by code.
Here are some captured images showing this behavior:
I was not able to find any method for getting the checked state of group command input checkbox.
Here is my sample code for demonstrating this issue:
import adsk.core, adsk.fusion, traceback app = None ui = None commandId = 'TestGroupCommandInput' commandName = 'Test Group Command Input' commandDescription = 'Test group command input' handlers = [] class MyCommandInputChangedHandler(adsk.core.InputChangedEventHandler): def __init__(self): super().__init__() def notify(self, args): try: cmd = args.firingEvent.sender inputs = cmd.commandInputs cmdInput = args.input groupCmdInput = inputs.itemById(commandId + '_group') checkBox1CommandInput = inputs.itemById(commandId + '_checkBox1') if cmdInput.id == commandId + '_TestButton': ui.messageBox('Group -> isEnabled: ' + str(groupCmdInput.isEnabled) + '\n' + 'Check Box 1 -> isEnabled: ' + str(checkBox1CommandInput.isEnabled)) elif cmdInput.id == commandId + '_ChangeByCodeButton': groupCmdInput.isEnabled = not(groupCmdInput.isEnabled) return True except: if ui: 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: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler): def __init__(self): super().__init__() def notify(self, args): try: cmd = args.command onDestroy = MyCommandDestroyHandler() cmd.destroy.add(onDestroy) onInputChanged = MyCommandInputChangedHandler() cmd.inputChanged.add(onInputChanged) handlers.append(onDestroy) handlers.append(onInputChanged) inputs = cmd.commandInputs global commandId groupCmdInput = inputs.addGroupCommandInput(commandId + '_group', 'Group') groupCmdInput.isExpanded = True groupCmdInput.isEnabledCheckBoxDisplayed = True groupChildInputs = groupCmdInput.children checkBox1CommandInput = groupChildInputs.addBoolValueInput(commandId + '_checkBox1', 'Check Box 1', True) checkBox2CommandInput = groupChildInputs.addBoolValueInput(commandId + '_checkBox2', 'Check Box 2', True) testButtonCommandInput = inputs.addBoolValueInput(commandId + '_TestButton', 'Test Enabled States', False) changeByCodeButtonCommandInput = inputs.addBoolValueInput(commandId + '_ChangeByCodeButton', 'Change Enabled State By Code', False) testButtonCommandInput.isFullWidth = True changeByCodeButtonCommandInput.isFullWidth = True except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def run(context): ui = None try: global app app = adsk.core.Application.get() global ui ui = app.userInterface global commandId global commandName global commandDescription cmdDef = ui.commandDefinitions.itemById(commandId) if not cmdDef: cmdDef = ui.commandDefinitions.addButtonDefinition(commandId, commandName, commandDescription) 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()))
Website: https://perceptino.com
Solved! Go to Solution.