Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BUG: update now throws exception setting isFullWidth on TableCommandInput object.

7 REPLIES 7
Reply
Message 1 of 8
SendItCNC
558 Views, 7 Replies

BUG: update now throws exception setting isFullWidth on TableCommandInput object.

After the latest update (2.0.15291 x86_64 on MacOS) I get now get an exception when setting isFullWidth = True on a TableCommandInput object. "RuntimeError: 2 : InternalValidationError : control"

 

Worked previously. Breaks our app. Anybody else?

 

Thanks, -Dave

7 REPLIES 7
Message 2 of 8

Hi @SendItCNC 

Yep! Noticed yesterday same issue reported to the team will let you know if I got some updates.

 


Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 8

A user reported the same issue for one of my addin on Windows (Tube Bending Data Exchanger).

I hope the team will find and fix this bug soon.

Message 4 of 8
SendItCNC
in reply to: SendItCNC

New version of Fusion today, which unfortunately does not address this bug. So I guess its time to upload new version of our app, modified with a workaround to address this issue...

Message 5 of 8
JeromeBriot
in reply to: SendItCNC
Message 6 of 8
thomasa88
in reply to: SendItCNC

Reported by users of ParametricText add-in as well: https://github.com/thomasa88/ParametricText/issues/47

 

It seems that full width is now enabled by default, or the possibility to show the name has been removed, as the name specified in addTableCommandInput() does not show up.

 

Fusion versions:

  • 2.0.15291 x86_64
  • 2.0.15293

 

Here is a reproduction using a modified version of the Command Inputs Sample script:

 

Error:

 

c:\Users\Thomas\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Scripts\Command API Inputs sample
Failed:
Traceback (most recent call last):
  File "C:/Users/Thomas/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/Command API Inputs sample/Command API Inputs sample.py", line 46, in notify
    tableInput.isFullWidth = True
  File "C:\Users/Thomas/AppData/Local/Autodesk/webdeploy/production/b266364513c09873dd62d7f39897939da3664358/Api/Python/packages\adsk\core.py", line 6144, in _set_isFullWidth
    return _core.CommandInput__set_isFullWidth(self, value)
RuntimeError: 2 : InternalValidationError : control

 

 

Code:

 

#Author-Autodesk Inc.
#Description-Demo command input examples
import adsk.core, adsk.fusion, traceback

_app = None
_ui  = None
_rowNumber = 0

# Global set of event handlers to keep them referenced for the duration of the command
_handlers = []


# Event handler that reacts to when the command is destroyed. This terminates the script.            
class MyCommandDestroyHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:
            # When the command is done, terminate the script
            # This will release all globals which will remove all event handlers
            adsk.terminate()
        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


# Event handler that reacts when the command definitio is executed which
# results in the command being created and this event being fired.
class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:
            # Get the command that was created.
            cmd = adsk.core.Command.cast(args.command)

            # Connect to the command destroyed event.
            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            # Get the CommandInputs collection associated with the command.
            inputs = cmd.commandInputs
           
            # Create table input
            tableInput = inputs.addTableCommandInput('table', 'Table Name', 3, '1:1:1')
            tableInput.isFullWidth = True
            
        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
            print('Failed:\n{}'.format(traceback.format_exc()))


def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface

        # Get the existing command definition or create it if it doesn't already exist.
        cmdDef = _ui.commandDefinitions.itemById('cmdInputsSample')
        if not cmdDef:
            cmdDef = _ui.commandDefinitions.addButtonDefinition('cmdInputsSample', 'Command Inputs Sample', 'Sample to demonstrate various command inputs.')

        # Connect to the command created event.
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        # Execute the command definition.
        cmdDef.execute()

        # Prevent this module from being terminated when the script returns, because we are waiting for event handlers to fire.
        adsk.autoTerminate(False)
    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

 

edit: getter is also broken:

Failed:
Traceback (most recent call last):
  File "C:/Users/Thomas/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/Scripts/Command API Inputs sample/Command API Inputs sample.py", line 46, in notify
    _ui.messageBox(str(tableInput.isFullWidth))
  File "C:\Users/Thomas/AppData/Local/Autodesk/webdeploy/production/b266364513c09873dd62d7f39897939da3664358/Api/Python/packages\adsk\core.py", line 6135, in _get_isFullWidth
    return _core.CommandInput__get_isFullWidth(self)
RuntimeError: 2 : InternalValidationError : control

 

 

My workaround:

# Fusion 2.0.15291 breaks isFullWidth. Exception: RuntimeError: 2 : InternalValidationError : control
    # Bug: https://forums.autodesk.com/t5/fusion-360-api-and-scripts/bug-update-now-throws-exception-setting-isfullwidth-on/m-p/11725404
    try:
        table_input.isFullWidth = True
    except RuntimeError:
        pass
Message 7 of 8
SendItCNC
in reply to: SendItCNC

Looks like this issue has now been fixed in the most recent update

2.0.15299

Message 8 of 8
JeromeBriot
in reply to: SendItCNC

Great news! Thanks for the quick fix.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report