Export dialog path

Export dialog path

Anonymous
Not applicable
826 Views
2 Replies
Message 1 of 3

Export dialog path

Anonymous
Not applicable

Hiya all!

 

I'm new to the Fusion 360 api, but I was hoping to change some of the default properties on the Export dialog (specifically the "Save to my computer..." path).

 

It seems like I should be able to catch the export command somewhere, and then modify the command inputs, but I haven't worked out a way to do that (I tried adding my own CommandStarting handler, but couldn't find a way to get/modify inputs in there).

 

Any suggestions would be helpful!

(Fallback is to create my own export dialog, but I'd rather not...)

 

Cheers,

Geoff

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

marshaltu
Autodesk
Autodesk
Accepted solution

Hello,

 

Unfortunately there is no API to support to customize the export dialog. Instead you can create export dialog by yourself and make use of ExportManager to do export. 

 

For example: the following codes show how to show save file dialog and export file as f3d. 

 

import adsk.core, adsk.fusion, traceback
 
def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        
        filedlg = ui.createFileDialog()
        filedlg.initialDirectory = '/Users/tum/Downloads/'
        filedlg.filter = '*.f3d'
        if filedlg.showSave() == adsk.core.DialogResults.DialogOK:
            design = adsk.fusion.Design.cast(app.activeProduct) 
            option = design.exportManager.createFusionArchiveExportOptions(filedlg.filename, design.rootComponent)
            design.exportManager.execute(option)
 
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
Message 3 of 3

Anonymous
Not applicable

Ah, well that makes sense, thank you!

0 Likes