Faulty Enum Types
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Link copied