Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Stakin
in reply to: daniel.puchta

Sub Main()
    Dim oAsmDoc As Inventor.AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument
    Zapnuti_occurrence  oAsmDoc
End Sub
Sub Zapnuti_occurrence( oDoc As Inventor.AssemblyDocument)
    Dim oSuppress_Occurrence As Boolean
    Dim oOccurrences As ComponentOccurrences
        oOccurrences =oDoc.ComponentDefinition.Occurrences
    Dim oModelState As ModelState
    Dim oModelState_created As Boolean
    
    oModelState_created = False
    For Each oOccurrence In oOccurrences 'tady to změnit na list
        oSuppress_Occurrence = False
        If oOccurrence.Suppressed = True Then
            oOccurrence.Unsuppress
            oSuppress_Occurrence = True
        End If

        If oOccurrence.DefinitionDocumentType = kAssemblyDocumentObject Then
            If InStr(oOccurrence.Definition.Document.DisplayName, new_element) = 0 Then
                oDoc.Update
            End If
            Rem In the Opened Asm File,All the oOccurrence were opened in memeroy,needn't use the document open method again; try this.
            Zapnuti_occurrence oOccurrence.Definition.Document
        End If
    Next
oDoc.Save
End Sub

In the Opened Asm File,All the oOccurrence were opened in memeroy,needn't use the document open method again; try this.