<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GroupCommandInput with checkbox does not behave as expected in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537146#M19392</link>
    <description>&lt;P&gt;Thank you for reporting this.&amp;nbsp; This was an oversight and we need to add a new property to the GroupCommandInput object to be able to get and set whether the check box is checked or not.&amp;nbsp; The existing isEnabled property does something similar but different.&amp;nbsp; You can see when it's true, then the group name is now gray in color and the group is not available.&amp;nbsp; All command inputs support the isEnabled property so the check box is something unique to the GroupCommandInput and needs a separate property to control it.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2016 16:38:29 GMT</pubDate>
    <dc:creator>ekinsb</dc:creator>
    <dc:date>2016-09-01T16:38:29Z</dc:date>
    <item>
      <title>GroupCommandInput with checkbox does not behave as expected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6535820#M19391</link>
      <description>&lt;P&gt;When&amp;nbsp;GroupCommandInput.isEnabledCheckBoxDisplayed is set to True,&amp;nbsp;despite the expected behavior, isEnabled property will always be&amp;nbsp;True regardless of the group command input checkbox state. isEnabled property will be false&amp;nbsp;only when we set it to false by code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are some captured images showing&amp;nbsp;this behavior:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture_06.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/268913i60848CA10302BBDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_06.png" alt="Capture_06.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture_07.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/268911iF2A45E92255A5983/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_07.png" alt="Capture_07.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture_05.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/268912iF0D193919D09D4F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_05.png" alt="Capture_05.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was not able to find any method for getting&amp;nbsp;the checked state of group command input checkbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my sample code for demonstrating this issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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 -&amp;gt; isEnabled: ' + str(groupCmdInput.isEnabled) + '\n' + 'Check Box 1 -&amp;gt; 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()))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 05:43:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6535820#M19391</guid>
      <dc:creator>nnikbin</dc:creator>
      <dc:date>2016-09-01T05:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: GroupCommandInput with checkbox does not behave as expected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537146#M19392</link>
      <description>&lt;P&gt;Thank you for reporting this.&amp;nbsp; This was an oversight and we need to add a new property to the GroupCommandInput object to be able to get and set whether the check box is checked or not.&amp;nbsp; The existing isEnabled property does something similar but different.&amp;nbsp; You can see when it's true, then the group name is now gray in color and the group is not available.&amp;nbsp; All command inputs support the isEnabled property so the check box is something unique to the GroupCommandInput and needs a separate property to control it.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 16:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537146#M19392</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-09-01T16:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: GroupCommandInput with checkbox does not behave as expected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537340#M19393</link>
      <description>&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your comprehensive answer. I think a&amp;nbsp;problems in dedicating a separate property to&amp;nbsp;the checked state of the checkbox will be the confusing name of&amp;nbsp;&lt;EM&gt;isEnabledCheckBoxDisplayed&lt;/EM&gt;. The name suggests that the checkbox is bound&amp;nbsp;to &lt;EM&gt;isEnabled&lt;/EM&gt; property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering what will be the negative point(s) of using &lt;EM&gt;isEnabled&lt;/EM&gt; property as the checked state property? As you mentioned&amp;nbsp;all command inputs support &lt;EM&gt;isEnabled&lt;/EM&gt; property, but all of them can potentially have unique features when draw themselves in disabled state. So the &lt;EM&gt;GroupCommandInput&lt;/EM&gt;&amp;nbsp;who's&amp;nbsp;&lt;EM&gt;isEnabledCheckBoxDisplayed&lt;/EM&gt; is set to true&amp;nbsp;can draw itself in enabled state with a checked checkbox and in disabled state with an unchecked checkbox. Is there any scenario that separating &lt;EM&gt;isEnabled&lt;/EM&gt; property from the checked state of the checkbox benefit users or developers?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One answer to my question could be: "The user should not be able to control the enabled state of command inputs". But I think we only use &lt;EM&gt;GroupCommandInput&lt;/EM&gt; with checkbox if we want to&amp;nbsp;get the ability of&amp;nbsp;controlling the&amp;nbsp;enabled state of the group to users. Otherwise we can use simple&amp;nbsp;&lt;EM&gt;GroupCommandInput&lt;/EM&gt;&lt;EM&gt;.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my &lt;A href="https://apps.autodesk.com/FUSION/en/Detail/Index?id=2750937976163552948" target="_self"&gt;Fracture&lt;/A&gt; add-in&amp;nbsp;I need such&amp;nbsp;&lt;EM&gt;GroupCommandInput&lt;/EM&gt; for "Voronoi Level 2 Divisions" and "Explosion" group command inputs (as shown in the following screen captures). Currently I've used separate checkboxes for enabling and disabling related&amp;nbsp;parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture_08.png" style="width: 525px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/269142iD9AED852911D5F86/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture_08.png" alt="Capture_08.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Navid&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 17:58:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537340#M19393</guid>
      <dc:creator>nnikbin</dc:creator>
      <dc:date>2016-09-01T17:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: GroupCommandInput with checkbox does not behave as expected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537580#M19394</link>
      <description>&lt;P&gt;I don't disagree that setting a group as disabled probably isn't particularly useful, but because this property is inherited from the CommandInput base class I think it's best to be consistent in the behavior across all command inputs. &amp;nbsp;Typically where the isEnabled property would be used is if there are inputs that the user can't access yet because of various other states but you still want them to see and be aware that the setting exists. &amp;nbsp;For example, the Extrude command has an "Objects To Cut" input on the dialog but it's disabled when initially creating an extrude feature and is only enabled when editing an existing extrusions. &amp;nbsp;It could also be that you need to collect inputs in a certain order and you could control the order by disabling inputs until you're ready for them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree with you that the name of the property is misleading. &amp;nbsp;isCheckBoxDisplayed would have been better. &amp;nbsp;We'll be adding a new isCheckBoxChecked property, probably in&amp;nbsp;the end of October update.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:43:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537580#M19394</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-09-01T19:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: GroupCommandInput with checkbox does not behave as expected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537649#M19395</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp;Totally agree with you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:11:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/groupcommandinput-with-checkbox-does-not-behave-as-expected/m-p/6537649#M19395</guid>
      <dc:creator>nnikbin</dc:creator>
      <dc:date>2016-09-01T20:11:36Z</dc:date>
    </item>
  </channel>
</rss>

