- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good evening,
I have found I can generate a hard crash of Fusion 360 (see, e.g., CER_183996679) by returning focus to the initial document from within a command. By initial document, I mean the document that was active when you executed the command.
This is true whether you lose focus by creating a new document or opening an existing one, and whether you return focus by closing the new document or by using the activate() method of the initial document. The code snippet below causes the hard crash every time:
def returnFocusTest(): app = adsk.core.Application.get() startingDoc = app.activeDocument otherDoc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType) adsk.doEvents() startingDoc.activate() adsk.doEvents()
However, this is only true when the command generates a command dialog. Running returnFocusTest() as a script works fine. As does putting it the command execute handler of a dialog-free command. However, as soon as you add any command input to the create event handler (even if they go unused) then the function above causes Fusion 360 to crash on the activate() line.
I have a vague recollection of this issue being discussed several years ago, but I can't find any reference to it in the forums. Has anyone else come across this? Does anyone know a way around it? And secondarily, is Autodesk aware of it?
Thank you everyone for your help.
Solved! Go to Solution.