Exporting electronics documents

Overview

The ElectronicsExportManager type is how you write the current Electronics document to disk in EAGLE 9.6.2-compatible formats. You do not create the manager yourself; you read the exportManager property from the product you already have:

The workflow matches other Fusion automation that uses an “input object” style API (similar in spirit to CAM post-processing where you create an input object, set fields, then run an operation):

  1. Call the create…ExportOptions factory that matches your product and desired file type.
  2. Optionally adjust outputPath (or other supported options in a future release).
  3. Call execute(options) and check the boolean return value.

You should already have a Board, Schematic, or Library reference from Application.activeProduct and cast, as described in Introduction to the Electronics API.

Supported export formats

Use the factory that matches both the product and the file extension you need. If you call a factory on the wrong exportManager, the method returns None (null in C++).

Product Factory on exportManager File
Board createEagleBrdExportOptions(outputPath) EAGLE 9.6.2 .brd
Schematic createEagleSchExportOptions(outputPath) EAGLE 9.6.2 .sch
Library createEagleLbrExportOptions(outputPath) EAGLE 9.6.2 .lbr

outputPath is the full path, including the file name and extension, for example C:/export/design.brd.

ElectronicsExportOptions

ElectronicsExportOptions is the object returned by the createEagle*ExportOptions methods. For this API surface, the important member is outputPath: you can read it or assign a new string if you need to change the destination after you create the options object and before you call execute.

Example: board (.brd)

The example below is a full script fragment: it obtains the application, casts activeProduct to a board, then creates .brd options, optionally overrides the path, and calls execute. Always test the return value of execute.

# Get a board from the active product, then export to .brd.
import adsk.core
import adsk.electron

app = adsk.core.Application.get()
board = adsk.electron.Board.cast(app.activeProduct)
if board is None:
    return

# Build options for a board export.
options = board.exportManager.createEagleBrdExportOptions("C:/export/design.brd")
if options is None:
    return  # wrong product or internal failure
# options.outputPath = "C:/export/alternate.brd"  # optional: change before execute

# Run the export and check the result.
if not board.exportManager.execute(options):
    app.log("Board export failed.")