Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Can I rollback a command transaction if something goes wrong while executing it?

marcosscriven
Enthusiast

Can I rollback a command transaction if something goes wrong while executing it?

marcosscriven
Enthusiast
Enthusiast

I have an add-in that has multiple steps. I'd like to be able to cancel or rollback the command if there are any exceptions, and there'd be nothing to 'undo'.

 

0 Likes
Reply
Accepted solutions (1)
382 Views
2 Replies
Replies (2)

thomasa88
Advocate
Advocate
Accepted solution

If you perform all the steps in the same Execute event handler, have a look at Command.executeFailed and Command.executeFailedMessage: http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-e3265681-b325-425b-8cf9-f2beaea4c305

2 Likes

marcosscriven
Enthusiast
Enthusiast

Thanks @thomasa88 - this worked:

def notify(self, args):
  ...
  eventArgs = adsk.core.CommandEventArgs.cast(args)
  eventArgs.executeFailed = False
0 Likes