Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Fusion 360 API: Customized Export Dialog

$
0
0

By Xiaodong Liang

This is a solution described in the forum post. The blog is basically for making the related codes be more searchable. 

The built-in dialog of [Export] is not customizable currently. While the API provides an object FileDialog that can be a workaround. i.e. make your own Export dialog and specify the parameters you would like to have such as file path and file type. This dialog is still a traditional type. I will write another blog on how to make an HTML dialog like the same style of built-in Export dialog.

Screen Shot 2017-08-21 at 2.49.43 PM

 

 

 


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'
        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()))

Viewing all articles
Browse latest Browse all 518

Trending Articles