Please check your AddIn to see if Fusion 360 calls "execute" before the User can click on "OK" or "Cancel"

Please check your AddIn to see if Fusion 360 calls "execute" before the User can click on "OK" or "Cancel"

tim.collins29V9X
Enthusiast Enthusiast
283 Views
2 Replies
Message 1 of 3

Please check your AddIn to see if Fusion 360 calls "execute" before the User can click on "OK" or "Cancel"

tim.collins29V9X
Enthusiast
Enthusiast

It seems Fusion 360 calls the "execute" handler without the user ever clicking the "OK" button. This happens whenever Fusion 360 needs to close the command dialog to run some other dialog.  In my case and many others this can create a major problem for the end user.

 

This is very easy to reproduce:

 

  1. Use the Fusion 360 command to make a new AddIn and run it using "Debug". In Visual Studio set a breakpoint on "command_execute" in entry.py
  2. Invoke the AddIn as usual and bring up the command dialog that shows "Some Text" and "Some Value" and the OK and CANCEL buttons as usual. Leave this up. Do not click anywhere in the dialog.
  3. Go the the SOLID tab and under MODIFY pick "fx Change Parameters." This also seems to work for any command that needs a new dialog displayed.
  4. Visual Studio will stop at the breakpoint in command_execute and the usual stack trace is shown.
  5. In Visual Studio debug, click the "run" arrow. The sample AddIn runs as it usually does and shows output  up on the screen. Go ahead and close the response dialog box.
  6. Only then does the "fx Parameters" dialog open up. 

Is anyone else seeing this?  Can anyone suggest a workaround? Can I get a sense of when this might, or might never, get improved? 

0 Likes
Accepted solutions (1)
284 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

I believe you've run into a little-known command behavior. It's surprising this doesn't come up more often. By default, if a command is running and terminated due to another command starting, the running command is executed. However, you have control over this behavior through the isExecutedWhenPreEmpted property of the Command object.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

tim.collins29V9X
Enthusiast
Enthusiast
Thanks Brian, that does solve the problem.
0 Likes