Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UserInterface event OnEnvironmentChange limitation (triggers only for last release)

8 REPLIES 8
Reply
Message 1 of 9
Maxim-CADman77
362 Views, 8 Replies

UserInterface event OnEnvironmentChange limitation (triggers only for last release)

As author of several Inventor Add-Ins I used to have several releases installed on my working PC simultaneously.
I initialize them (one-by-one) for check/debug my add-ins.


Recently I've discovered that UserInterfaceEvents.OnEnvironmentChange Event is not triggered in all Inventor releases installed except for newest.

 

Steps to reproduce (need to have installed at least two Inventor releases, I believe any releases):

 

1. Run newer Inventor (ex.2025)
2. Run Event Watcher 2025 (need to install DeveloperTools from Inventor-2025-SDK) and activate UserInterfaceEvents.OnEnvironmentChange
3. Switch to Inventor 2025 and open/activate Inventor document and witness Event Watcher logs each Environment change.

 

4. Close Event Watcher 2025 and Inventor 2025

 

Repeat steps 1-3 for some older Inventor, for example:

 

5. Run Inventor 2024
6. Run Event Watcher 2024 (need to install DeveloperTools from Inventor-2024-SDK) and activate UserInterfaceEvents.OnEnvironmentChange
7. Switch to Inventor 2024 and open/activate Inventor document and witness Event Watcher DON'T LOG any of Environment changes.

 

Thus Environment change dependent functionality of my add-ins doesn't work for the given Inventor release if newer Inventor is also installed.

 

I wonder if anybody could confirm reproducibility of the issue described?

 

I also would like @MjDeck and @johnsonshiue be aware of this thread.

8 REPLIES 8
Message 2 of 9
MjDeck
in reply to: Maxim-CADman77

Hi Maxim - the problem might be in the Event Watcher tool. Does the event work in your add-in?


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 9
Maxim-CADman77
in reply to: MjDeck

Dear @MjDeck 
The first place where the problem was reproduced was my addin and only then it was confirmed with  Event Watcher.

And today I can't get the event trigger even in Inventor 2025.0.1.

Whether I supposed to do a reset or something alike?

Message 4 of 9
MjDeck
in reply to: Maxim-CADman77

I tested in Inventor 2024.3 and 2025.0.1 with the attached add-in, and the event works fine. Can you test with this add-in? It uses Trace.WriteLine to log info about the event. To see the output, attach a debugger or use DebugView.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 9
Maxim-CADman77
in reply to: MjDeck

As ZIP doesn't contain DLL I open in with Visual Studio (Community 2022) and get this dialog:

MaximCADman77_0-1718377291434.png

Is it OK to upgrade?



Message 6 of 9
MjDeck
in reply to: Maxim-CADman77

Yes, it should be OK to upgrate it to Framework 4.8. I will try it on Visual Studio 2022.

Edit: I tried it and it works fine.


Mike Deck
Software Developer
Autodesk, Inc.

Message 7 of 9
Maxim-CADman77
in reply to: MjDeck

Seems like your add-in behaves the same as Event Watcher.

The issue itself seems to be local (it is not reproducible on my auxiliary PC).

 

As to main PC - resetting a particular release sometimes help, but not each time.

 

I begin to think something is wrong with my Inventor or Windows profile.

 

Don't you know if it Restore-a-Corrupt-Inventor-User-Profile procedure is applicable for actual releases (it lists 2016-2019)?

Message 8 of 9

Did you reboot the computer?

I was testing after I saw your post and I got the same problem.  Event Handler didn't work at all.

I have another crashed IV running.

Message 9 of 9
MjDeck
in reply to: Frederick_Law

I don't see a problem with the OnEnvironmentChange event in either 2024 or 2025.

You might have to run a given version of Inventor once and then exit the process to make sure it's registered.

Here's a workflow:

  • use Task Manager to make sure no instance of Inventor.exe is running
  • start Inventor 202x
  • exit Inventor 202x
  • restart Inventor 202x
  • start Event Watcher 202x
  • test UserInterfaceEvents.OnEnvironmentChange
  • exit Event Watcher 202x
  • exit Inventor 202x
  • start Inventor 202y
  • exit Inventor 202y
  • restart Inventor 202y
  • start Event Watcher 202y
  • test UserInterfaceEvents.OnEnvironmentChange

Mike Deck
Software Developer
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report