<?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 Faulty Enum Types in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/12066483#M3392</link>
    <description>&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. createInput is defined as:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def createInput(self, profile: core.Base, operation: FeatureOperations) -&amp;gt; ExtrudeFeatureInput:&lt;/LI-CODE&gt;&lt;P&gt;But the class FeatureOperations reads:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;Which yields an error&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Argument of type "int" cannot be assigned to parameter "operation" of type "FeatureOperations" in function "createInput"
  "int" is incompatible with "FeatureOperations"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to my understanding the following would fix the issue:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from enum import Enum

class FeatureOperations(Enum):
    # ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Am I missing something?&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 13:34:08 GMT</pubDate>
    <dc:creator>felix85SA3</dc:creator>
    <dc:date>2023-06-28T13:34:08Z</dc:date>
    <item>
      <title>Faulty Enum Types</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/12066483#M3392</link>
      <description>&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g. createInput is defined as:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def createInput(self, profile: core.Base, operation: FeatureOperations) -&amp;gt; ExtrudeFeatureInput:&lt;/LI-CODE&gt;&lt;P&gt;But the class FeatureOperations reads:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;Which yields an error&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Argument of type "int" cannot be assigned to parameter "operation" of type "FeatureOperations" in function "createInput"
  "int" is incompatible with "FeatureOperations"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to my understanding the following would fix the issue:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from enum import Enum

class FeatureOperations(Enum):
    # ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Am I missing something?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 13:34:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/12066483#M3392</guid>
      <dc:creator>felix85SA3</dc:creator>
      <dc:date>2023-06-28T13:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Faulty Enum Types</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13787135#M22161</link>
      <description>&lt;P&gt;I've run into this exact same issue. Did you figure out a workaround, other than adding "&lt;SPAN&gt;# type: ignore" everywhere?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fusion Python API maintainers - please fix this!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 14:15:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13787135#M22161</guid>
      <dc:creator>benalman</dc:creator>
      <dc:date>2025-08-28T14:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Faulty Enum Types</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13797529#M22170</link>
      <description>&lt;P&gt;I think the problem you're referring to is a result of the Fusion API not using the Python Enum class, but instead defines enums using a standard class with variables with integer values that define the enum values. The reason for that is that Python Enums didn't exist in the language when the API was first released, and this was the workaround chosen. It would be beneficial if the API could be updated to utilize the new Python Enum class; however, I am unsure if that is possible without breaking all existing code that uses enums. I don't know if the possibility has been investigated or not.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 01:14:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13797529#M22170</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2025-09-05T01:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Faulty Enum Types</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13804798#M22179</link>
      <description>&lt;P&gt;In the meantime, I have started calling&amp;nbsp;&lt;STRONG&gt;cast()&lt;/STRONG&gt; explicitly whenever I use an&amp;nbsp;&lt;STRONG&gt;adsk&lt;/STRONG&gt; Enum-like value. It adds more code, but it allows type hinting to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dimensions.addDistanceDimension(
  startPoint,
  endPoint,
  adsk.fusion.DimensionOrientations.HorizontalDimensionOrientation, # type: ignore
  textPoint
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from typing import cast

dimensions.addDistanceDimension(
  startPoint,
  endPoint,
  cast(adsk.fusion.DimensionOrientations, adsk.fusion.DimensionOrientations.HorizontalDimensionOrientation),
  textPoint
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if it's possible to create macros in Python, but if it is, that could possible reduce some of the extra code.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 14:02:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/faulty-enum-types/m-p/13804798#M22179</guid>
      <dc:creator>benalman</dc:creator>
      <dc:date>2025-09-10T14:02:01Z</dc:date>
    </item>
  </channel>
</rss>

