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: 

Faulty Enum Types

0 REPLIES 0
Reply
Message 1 of 1
felix85SA3
213 Views, 0 Replies

Faulty Enum Types

I'm new to Python and used to strict type checking, so I just set up my VSCode and found that the enumeration types that are used throughout the definition files (%appdata%\Autodesk\Autodesk Fusion 360\API\Python\defs\fusion.py) lack Enum-inheritance

 

E.g. createInput is defined as:

def createInput(self, profile: core.Base, operation: FeatureOperations) -> ExtrudeFeatureInput:

But the class FeatureOperations reads:

class FeatureOperations():
    """
    List of the different operations a feature can perform.
    """
    def __init__(self):
        pass
    JoinFeatureOperation = 0
    CutFeatureOperation = 1
    IntersectFeatureOperation = 2
    NewBodyFeatureOperation = 3
    NewComponentFeatureOperation = 4

Which yields an error

Argument of type "int" cannot be assigned to parameter "operation" of type "FeatureOperations" in function "createInput"
  "int" is incompatible with "FeatureOperations"

 

According to my understanding the following would fix the issue:

from enum import Enum

class FeatureOperations(Enum):
    # ...

 

 Am I missing something?

Labels (1)
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report