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.
Understanding MemberEditScope
The MemberEditScope
property determines which model states are affected during an edit operation. It can be one of the following:
Constant | Description |
---|---|
kEditActiveMember |
Only the currently active model state is edited. |
kEditAllMembers |
All model states are edited. |
kEditMultipleMembers |
Multiple (but not all) model states are in edit mode. |
Note: If MemberEditScope
returns kEditMultipleMembers
, you must 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
becomeskEditActiveMember
. - If it contains all model states,
MemberEditScope
becomeskEditAllMembers
. - If it includes the active model state plus some others,
MemberEditScope
becomeskEditMultipleMembers
.
Best Practice: Always include the active model state when assigning ModelStatesInEdit
.
Example 1: Print the Current MemberEditScope
This VBA macro prints the current edit scope in the Immediate Window:
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
Example 2: List Model States in Edit Mode
This macro prints the names of model states currently 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
This macro dynamically updates which model states are in edit mode without using the Inventor UI:
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
🔄 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.- Always include the active model state when using
ModelStatesInEdit
. - Use these properties to automate complex modeling scenarios across design variants.
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 ModelStatesInEdit
, you gain full control over your Inventor automation workflows!