Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Instigate Cancel Button Click using code (Python)

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ebunn3
108 Views, 2 Replies

Instigate Cancel Button Click using code (Python)

Hi,

 

Is there a way to close an open userform with code (like hitting the Cancel button)?  Currently I have a message box popup instructing the user to close and reopen the form after a certain action is taken.  I would like to automatically close the form when this happens instead of prompting them to hit cancel.

 

Thanks in advance,

 

Eric

2 REPLIES 2
Message 2 of 3
BrianEkins
in reply to: ebunn3

There is no way to cancel a message box.

 

I thought there was a way to cancel a command dialog but just looked and see it was never implemented. There should be a doCancel method on the command that would be the equivalent of clicking the Cancel button on the command dialog. A workaround will be to execute another command, which will terminate the currently running command. The default command in Fusion, when no other command is running is the "Select" command. You can execute that to kill the current command and put Fusion in its default state.

 

selCommand = ui.commandDefinitions.itemByName('SelectCommand')
selCommand.execute()
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3
ebunn3
in reply to: BrianEkins

Thank you Brian.  I'll try it out.

 

Eric

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report