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: 

How to get rid of type errors regarding DropDownStyles?

3 REPLIES 3
Reply
Message 1 of 4
tiktuk
118 Views, 3 Replies

How to get rid of type errors regarding DropDownStyles?

Hi,

 

I get this error:

 

 

Argument of type "int" cannot be assigned to parameter "dropDownStyle" of type "DropDownStyles" in function "addDropDownCommandInput"
  "int" is incompatible with "DropDownStyles"

 

 

The code is like the one in the example in the official documentation, which also shows the error:

 

 

dropdownInput = tab1ChildInputs.addDropDownCommandInput('dropdown', 'Dropdown 1', adsk.core.DropDownStyles.CheckBoxDropDownStyle)

 

 

The code is actually working, I would just like to get rid of all type errors, so real errors are not obscured by a long list of problems in VS Code.

 

If I change the definition of DropDownStyles in core.py, so it is subclassed from Enum, the error goes away. So is it because the class is not properly defined?

 

class DropDownStyles(Enum):
    """
    Defines the different styles that a drop-down input can be.
    """
    def __init__(self):
        pass
    LabeledIconDropDownStyle = 0
    TextListDropDownStyle = 1
    CheckBoxDropDownStyle = 2

 

3 REPLIES 3
Message 2 of 4
Jorge_Jaramillo
in reply to: tiktuk

Which OS and Fusion 360 version are you using?
I'm running Fusion 360 2.0.17954 x86_64 with no issues on it.
Message 3 of 4
tiktuk
in reply to: Jorge_Jaramillo

I'm on Fusion 360 2.0.17954 arm64 [Native] / macOS 13.6.1 (22G313) on MacBookAir10,1.

 

Do you mean the script works or that you don't get the error message in VS Code?

 

 

Message 4 of 4
Jorge_Jaramillo
in reply to: tiktuk

I don't get any error and my script works without any issue.
Could you share your .vscode/settings.json file content?

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