- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @C_Haines_ENG. When we create event handlers, we often need to design in more than one way to remove / eliminate that event handler. In your case, the only way out is for your variable 'oFrame' to get a value assigned to it. Well, if you run that rule, but then exit out of selection mode with the Escape key (or equivalent), without ever selecting anything, then that may never happen, which may cause the event handler to continue running in the background until you restart Inventor. In theory, your action of pressing the escape key should terminate the 'interaction' mode, but that may have not released the reference to those resources. In your code, that release would have only happened after 'oFrame' had been assigned a value. You may want to at lease 'handle' the InteractionEvents.OnTerminate Event, in addition to the OnSelect Event. That way, when you terminate interaction mode, the event handler for that action will have a chance to stop things, and negate object references. I also generally recommend using the [AddHandler Object.Event, AddressOf Object_Event] way of specifying event handlers, instead of using the keywords ['WithEvents' & 'Handles'] to do that, when first getting into creating event handlers, because this gives you an added way to 'remove' them, using the [RemoveHandler Object.Event, AddressOf Object_Event] phrase. Often, when you create an event handler with an iLogic rule, if you did not include extra code in that original rule that creates it, then you will not be able to stop it again, until you quit and/or restart Inventor. You can not simply edit the rule that created & launched it, to change its behavior, while it is running in the background, because that code is being held in Inventor's memory now, so you usually need to restart Inventor before editing that rule. And hopefully that rule has not already been ran again automatically by the time you can get to it for editing it.
Wesley Crihfield
(Not an Autodesk Employee)