The Fusion Electronics API is designed to give you a high level of automation over schematics, PCB layouts, and component libraries. Electronics functionality is defined in the adsk.electron library.
This release of the Electronics API is in preview and is read-only for modifying the design: you can read design data, navigate the object model, convert coordinates, and export to supported formats. Write operations (creating or editing layout content) are not part of the public API surface in this release.
The object model is based on User Language Programs (ULP)—the same board, schematic, library, and connectivity concepts appear in both. The main differences are that you write Python or C++ instead of the ULP language, and you obtain your context through the standard Fusion API pattern.
For general scripting—creating scripts and add-ins, language behavior, and debugging—see the Fusion 360 API documentation.
Import adsk.electron into your script or add-in. If you use Create in the Scripts and Add-Ins dialog, you will typically start from a template that already imports adsk.core; add the Electronics namespace.
# Imports for an Electronics script.
import adsk.core
import adsk.electron
import traceback
If you use Create from the Scripts and Add-Ins Manager to start a C++ add-in, your generated project includes the usual Fusion include paths and using directives for the namespaces you select. Add the Electronics headers and the adsk::electron types the same way as adsk::core, adsk::fusion or adsk::cam
The active product is what the current workspace is editing. For Electronics, the active product is a schematic, a board, a library, or an electronics design project, depending on which document and workspace the user has open.
When you need data through the API, you first get the Product that holds that data, then cast it to the Electronics class you expect (Schematic, Board, Library, or EcadDesign).
If the user is already in the Electronics workspace that matches the data you need, Application.activeProduct is the right product. The example below casts activeProduct to each Electronics type in turn. Only the cast that matches the active product returns a non-None value.
# Get the application.
app = adsk.core.Application.get()
ui = app.userInterface
# Get the active product and try Electronics casts.
product = app.activeProduct
schematic = adsk.electron.Schematic.cast(product)
board = adsk.electron.Board.cast(product)
library = adsk.electron.Library.cast(product)
ecadDesign = adsk.electron.EcadDesign.cast(product)
# Only one of the four is non-None for a given active product, depending on document type and workspace.
if board is None and schematic is None and library is None and ecadDesign is None:
ui.messageBox("The active product is not an Electronics type this script expects.")
The Electronics API uses the same collection pattern you see in CAM and elsewhere in Fusion: a count and an item(index) method, with a 0-based index. For example, sheets, libraries, and variantDefs (among many others) all follow this shape.
The example below walks every sheet in a schematic. The same count / item pattern applies to other collections on Schematic, Board, and Library.
# Get the first sheet, then the next, until you have traversed the collection.
for i in range(int(schematic.sheets.count)):
sheet = schematic.sheets.item(i)
# ... use sheet
Units helpers.brd, .sch, .lbr)