Managing Model States Edit Scope in Autodesk Inventor 2026 API

by Chandra shekar Gopal,

When working with Model States in Autodesk Inventor, controlling which states are actively being edited becomes crucial—especially when automating complex design workflows. The Inventor API provides powerful control through two key properties:

  • MemberEditScope
  • ModelStatesInEdit

This article explains how to use these features to manage model states programmatically in Autodesk Inventor 2026, which introduces an important enhancement:

🔧 Inventor 2026 now allows write access to ModelStatesInEdit, enabling developers to directly modify which model states are in edit mode—something not supported in earlier versions.


🧩 Understanding MemberEditScope

The MemberEditScope property determines which model states are affected during an edit operation. It can be one of the following:

ConstantDescription
kEditActiveMemberOnly the currently active model state is edited.
kEditAllMembersAll model states are edited.
kEditMultipleMembersMultiple (but not all) model states are in edit mode.

Note: If MemberEditScope returns kEditMultipleMembers, use ModelStatesInEdit to identify the specific model states being edited.


🎯 Understanding ModelStatesInEdit

The ModelStatesInEdit property is a read/write collection that explicitly lists which model states are in edit mode.

Behavior Rules:

  • If it contains only the active model state → MemberEditScope = kEditActiveMember
  • If it contains all model states → MemberEditScope = kEditAllMembers
  • If it includes the active model state plus others → MemberEditScope = kEditMultipleMembers

✅ Best Practice: Always include the active model state when assigning ModelStatesInEdit.


🔍 Example 1: Print the Current MemberEditScope


Sub PrintEditScope()

    Dim modelStates As ModelStates
    Set modelStates = ThisApplication.ActiveDocument.
        ComponentDefinition.
        ModelStates

    Select Case modelStates.MemberEditScope

        Case kEditActiveMember
            Debug.Print "kEditActiveMember"

        Case kEditAllMembers
            Debug.Print "kEditAllMembers"

        Case kEditMultipleMembers
            Debug.Print "kEditMultipleMembers"

    End Select

End Sub

Output Illustration – Example 1

MemberEditScope


📃 Example 2: List Model States in Edit Mode


Sub PrintModelStatesInEdit()

    Dim modelStates As ModelStates
    Set modelStates = ThisApplication.ActiveDocument.
        ComponentDefinition.
        ModelStates

    Dim inEdit As ObjectCollection
    Set inEdit = modelStates.ModelStatesInEdit

    Dim ms As ModelState

    For Each ms In inEdit
        Debug.Print ms.Name
    Next

End Sub

✏️ Example 3: Modify the Model States in Edit Mode (New in Inventor 2026)

Thanks to Inventor 2026, we can now dynamically update which model states are in edit mode programmatically:


Sub ModifyMultipleModelStatesSample()

    Dim oModelStates As ModelStates
    Set oModelStates = ThisApplication.ActiveDocument.
        ComponentDefinition.
        ModelStates

    Dim oCol As ObjectCollection
    Set oCol = ThisApplication.TransientObjects.CreateObjectCollection

    ' Activate Model State 2
    Dim oMS As ModelState
    Set oMS = oModelStates.Item(2)
    oMS.Activate

    ' Include ModelState2 to ModelState4 in edit mode
    Dim i As Integer
    For i = 2 To 4
        oCol.Add oModelStates.Item(i)
    Next i

    oModelStates.ModelStatesInEdit = oCol

End Sub

Output Illustration – Example 3

ChangeMemberEditScope

🔄 Before and After:

  • Before running: Only Model State 1 is in edit mode.
  • After running:
    • Model State 2 becomes active.
    • Model States 2, 3, and 4 are now in edit mode.

🔑 Key Takeaways

  • MemberEditScope defines how many model states are being edited.
  • ModelStatesInEdit gives precise control over which model states are in edit mode.
  • Inventor 2026 enhances this by allowing write access to ModelStatesInEdit.
  • Always include the active model state when modifying the collection.
  • Use these properties to automate configuration-driven modeling scenarios.

💡 Why This Matters

Model States are essential for representing different design variants or manufacturing stages within a single Inventor file. Controlling how and which states are edited programmatically is vital for:

  • Efficient model management
  • Automating large assemblies
  • Dynamically generating manufacturing configurations

By leveraging MemberEditScope and the new write-enabled ModelStatesInEdit in Inventor 2026, you gain full control over your Inventor automation workflows.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading