UserInputEvents - Problems with last Inventor 2023.3 Update

UserInputEvents - Problems with last Inventor 2023.3 Update

cdellea
Enthusiast Enthusiast
669 Views
7 Replies
Message 1 of 8

UserInputEvents - Problems with last Inventor 2023.3 Update

cdellea
Enthusiast
Enthusiast

Hi all,

 

I have some tools in an Inventor addin (written in C#) that uses UserInputEvents and InteractionEvents together. This as been working well for the 15 past years. But since update 2023.3, those tools are not working anymore. I am trying to understand where the problem comes from, but I am afraid this comes from a modification of the behavior in the API or a bug in the API.

 

The only thing I manage to discover is that the "OnTerminateCommand" event of the UserInputEvents is raised a soon as I started my tools. I dont know if this comes from the "InteractionEvent" .Start function or if there is nothing trigerring the event that is related to my code.

 

Anybody has experienced this problem ?

0 Likes
670 Views
7 Replies
Replies (7)
Message 2 of 8

cdellea
Enthusiast
Enthusiast

I found out what the problem is. The API behaviour is now modified since version 2023.3 (note that this new behaviour is not implemented in version 2024, which still works like before).

 

The modification is as follows :

 

Having a button (ButtonDefinition) with subscription to OnExecute event. When the OnExecute function is called and ended, the UserInputEvents.OnTerminateCommand event is raised. That was not the case before.

 

The problem is :

 

What about a tool launched with a button, which need selection from user to run ? A feature like this cannot be blocking (to allow selections), which means that the "OnExecute" method called will terminate before the function is actually completed. Leading to the "OnTerminateCommand" event being triggered when the command is not finished.

 

@Anonymous API Team : Is this new behavior intentional ? If so, how should the case described above be handled ? Knowing that the "UserInputEvents.OnTerminateCommand" event is needed to finalize the functionality (depending on whether the user validates, cancels or starts another function).

 

In advance, thank you very much for your advice and help.

 

Colin

 

0 Likes
Message 3 of 8

YuhanZhang
Autodesk
Autodesk

Hi Colin,

 

Can you provide a simplified project(non-confidential) for us to reproduce the problem? 

 

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 4 of 8

robertast
Collaborator
Collaborator

@YuhanZhang    You can check on the site, it also doesn't work in 2023.3 and works fine in 2024 https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/autodesk-inventor-2023-3-update-brea...

0 Likes
Message 5 of 8

cdellea
Enthusiast
Enthusiast

@YuhanZhang

 

Hi,

 

Well, as I dont master VBA (and I am not sure it is possible to reproduce the problem with VBA), I modified the sample SDK project "SimpleAddin". When you create a sketch in a part, the button of Simple Addin is available.

 

In 2023.3, when you click the button, you will see a message saying you clicked the button. As soon as you validate the MessageBox, another message is shown in the "UserInputEvents.OnTerminateCommand" that says the command ended.

 

In ALL OTHER Inventor version (including 2024 or 2023.2 for example), when you click the button, the message saying the button has been clicked is displayed. But no other message will show. That means the "UserInputEvents.OnTerminateCommand" event is not fired after the "ButtonDefinition.OnExecute" function is exited.

 

While this change in behavior makes sense, it does not cover all uses. As a general rule, any functionality that requires a selection cannot be considered complete when the OnExecute function is exited.

 

This modification is very impacting. I really need a solution about it.

 

Thank you very much.

0 Likes
Message 6 of 8

cdellea
Enthusiast
Enthusiast

In case this problem is impacting someone else, this problem has been logged as Change Request by developpement team with ID : INVGEN-69083

 

As you maybe know, the prioritization is based on "financial" impact. So if you need this problem to be solved, dont hesitate to let Autodesk know how it is impacting you with information like :

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
0 Likes
Message 7 of 8

YuhanZhang
Autodesk
Autodesk

Hi Colin,

 

Yes, we did enhance the UserInputEvents for ButtonDefinition.OnExecute in Inventor 2023.1(not merged to Inventor 2024 RTM). Before this enhancement the custom commands may not trigger the UserInputEvents.OnActivateCommand and OnTerminateCommand events and customers need to monitor the events so this enhancement allows users to know which custom command is activated/terminated. 

 

So ideally all your code that is used for your command should be run within the ButtonDefinition.OnExecute function, this makes the UserInputEvents.OnActivateCommand and OnTerminateCommand to be triggered with correct timing. Can you make sure that your code which requires selection to be run within the ButtonDefinition.OnExecute function? If you could not make it can you share us a non-confidential project with the code to reproduce it? 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 8 of 8

cdellea
Enthusiast
Enthusiast

Hello,

To begin with, I would say that any tool that uses "Interaction Events" will not be able to have all their code executed before exiting the "OnExecute" event. In fact, probably any tool that requires one or more selections (and does not use the useful but very limited "Pick" function) could have problems.

 

Can you please enlighten me on how you imagined (API dev team I mean) that a non-blocking feature should be implemented in connection with the change in API behavior? It seems obvious to me that not all features are blocking and that this case was taken into account by the development team before the change.

And is there any consultation with users or ADN members when such changes are considered?

 

I think that a simple argument when creating a button would allow to specify if the related functionality is blocking or not and therefore if the "OnTerminateCommand" event should be triggered or not when leaving the "OnExecute" function... Even easier, throw the "OnTerminateCommand" only when the "Pressed" property of the button becomes false !!!

 

Concerning a new example, it already took me a lot of time to create this post, to make the first example available to you and to respond. I am sure you are able to add to the simple addin the few lines needed to implement an "InteractionEvents" object. I also think that the tool use cases requiring a selection is very clear and does not require the creation of a new example.

 

Regards,

 

Colin

0 Likes