Clicking F6 during interaction event blocks Inventor

Clicking F6 during interaction event blocks Inventor

CattabianiI
Collaborator Collaborator
480 Views
2 Replies
Message 1 of 3

Clicking F6 during interaction event blocks Inventor

CattabianiI
Collaborator
Collaborator

I have many custom commands which manage user interaction with this widely used pattern: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2018/ENU/Inventor-API/files/In...

    Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents
    oInteractEvents.InteractionDisabled = False
    Set oSelectEvents = oInteractEvents.SelectEvents
    oSelectEvents.AddSelectionFilter filter
    oInteractEvents.Start

    ' Loop until a selection is made.
    Do While bStillSelecting
System.Windows.Form.Applicationt.DoEvents() 'ThisApplication.UserInterfaceManager.DoEvents Loop

Once interaction started if i click F6 to set the Home view Inventor freezes.

 

Debugging I noticed the execution is blocked inside DoEvents.
(To make Inventor responding is sufficient right click on the program in the task bar, click close window and Inventor will prompt the save message becoming responsive again)
If i click the Home view button near the cube or I double click the mouse wheel everything is ok.

 

To reproduce the problem: execute the rule inside the attached part, select first item, press F6.

I noticed that: executing the rule and pressing F6 does not work but at least does not block Inventor.

0 Likes
481 Views
2 Replies
Replies (2)
Message 2 of 3

CattabianiI
Collaborator
Collaborator

I solved replacing the Application.DoEvents() with 

Await System.Threading.Tasks.Task.Delay(1)

and making the method Async.

Could this approach create problem in other situations?
Is this the proper way to allow user interaction?


An official response would be really appreciate?

0 Likes
Message 3 of 3

CattabianiI
Collaborator
Collaborator

Could someone of Autodesk confirm the issue and tell if the proposed solution is good?
@chandra.shekar.g 

0 Likes