Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @bradeneuropeArthur 

Thank you for the quick reply.

 

My apologies; I did not proofread my code before I copied it to the forum.

 

I need to specify the occurrence name and then change its Model State.

 

Here is the code that is not working.

        Dim oDoc As AssemblyDocument
        oDoc = g_inventorApplication.ActiveDocument

        Dim oAssemblyCompDef As AssemblyComponentDefinition
        oAssemblyCompDef = oDoc.ComponentDefinition

        ' Specify an occurrence to change its active model state.
        Dim oOccu As ComponentOccurrence
        oOccu = oAssemblyCompDef.Occurrences.Item("Linear Bar")

        ' Get native document ComponentDefinition of occurrence.
        Dim oOccuDef As ComponentDefinition
        oOccuDef = oOccu.Definition

        oOccu.ActiveModelState = "CA400"

 

 

J_Dumont_0-1716234183323.png