Message 1 of 8
iLogic error on first run
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I have been trying to figure out why the below rule fails on the first run after opening the file. The rule was much longer, but I have narrowed it down to the below.
It is important to note that the rule only fails on the first run after opening the file. Afterwards it runs as expected.
The error seems to occur because of the "Feature.IsActive" lines which causes the variable "Bracket" to throw exception on all properties and methods. In this case the error occurs when trying to reach the visibility property of Bracket.
I have been using Inventor 2022 and I hope you guys can help me solve this small mystery 🙂
Sub Main 'The following two lines trigger an error the first time the rule is run after the document is opened. Dim Bracket As SurfaceBody Bracket = ThisDoc.Document.ComponentDefinition.SurfaceBodies.Item(1) 'When the feature is activated/deactivated, the variable o40x40 is "lost" Feature.IsActive("MirrorBracket") = True Feature.IsActive("MirrorBracket") = False 'Error occurs on next line as the variable "Bracket" has been "lost" If Bracket.Visible Then Bracket.Visible = False Else Bracket.Visible = True End If End Sub