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

Event Trigger Error

I have a rule in a iAssembly to set the LOD to "iLogic" when the file is opened. When I set the Event Triggers to run that rule when the file is opened I get the following error.

 

 

 Capture.PNG

 

The Rule is below. If someone could figure out what the issue is I would greatly appreciate it.

 

    defaultLoD = "Main LoD"
    customLoDExsits = False
	Dim doc as AssemblyDocument = ThisDoc.Document 
	Dim oLOD As LevelOfDetailRepresentation 
    Dim cLOD As LevelOfDetailEnum = kCustomLevelOfDetail
	Dim oAsmCompDef As ComponentDefinition = doc.ComponentDefinition
    Dim oFileManager As FileManager = ThisApplication.FileManager
    strLastActiveLOD = oFileManager.GetLastActiveLevelOfDetailRepresentation(ThisDoc.PathAndFileName(True))

    If oAsmCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.LevelOfDetail <> kCustomLevelOfDetail Then

        For Each custLod In oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations
            If custLod.Name = strLastActiveLOD Then
                If custLod.LevelOfDetail = 56072 Then
                    custLod.Activate(True)
                    customLoDExsits = True
                    Exit For
                End If
            Else
                If custLod.LevelOfDetail = 56072 Then
                    customLoDExsits = True
                    custLod.Activate(True)
                    Exit For
                End If
            End If
        Next custLod

        If customLoDExsits = False Then
            Dim nLOD As LevelOfDetailRepresentation
            nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic")
            oLOD = nLOD
            oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic").Activate(True)
        End If
    End If
	
InventorVb.DocumentUpdate()