Old Content - visit altium.com/documentation

The Altium Designer Application Programming Interface (API) exposes program functionality to external sources, such as the Altium Designer scripting system.

The API is composed of sub APIs, such as those offered by Altium Designer's range of design editors. For example the PCB editor has the PCB API, the Schematic editor has the Schematic API, the Project Manager has the Workspace manager API, Altium Designer platform has its own Client API, and so on.

Each API can compose of object interfaces, classes, routines and enumerated constants. The editor-specific APIs have their own Object Model, which in itself is a hierarchical system of Object Interfaces. These object interfaces represent Altium Designer's objects.

The Altium Designer API, its sub APIs and their Object Models

Object Model Hierarchy

Object Interfaces represent design objects, and can be used in scripts to access data in design documents that are open in Altium Designer.

Object Interfaces have properties and methods:

  • Methods of Object Interfaces are the actions an Object Interface can perform.
  • Properties of Object Interfaces represent the data contained in the object that's represented by the interface.

A parent object interface can have child object interfaces, and in turn, child object interfaces can act as parent object interfaces to child object interfaces, and so on down the chain.

This forms an Object Model Hierarchy. For example, in the Workspace Manager Object Model, the IWorkspace Object Interface is the top level interface representing the Workspace manager in Altium Designer. Projects are part of the Workspace Manager, therefore an IProject interface is a child interface to the parent IWorkspace interface.

Continuing on, documents are part of a project, so the IProject interface is the parent interface and IDocument is a child interface. Design objects such as sheet symbols, components and buses are child objects of the document object (represented by the IDocument interface).

This can be illustrated in the following simple example hierarchy:

IWorkspace
.  IProject
.  .  IDocument
.  .  .  ISheetSymbol
.  .  .  IComponent
.  .  .  IBus

The figure below is an illustration of the relationship between objects in Altium Designer, and the object Interfaces supported by the various Object Models from Altium Designer API.

Projects and the corresponding documents are managed by the Workspace Manager. A project open in Altium Designer is represented by the IProject object interface, and the documents from this project are represented by the IDocument interfaces.

As also shown, the PCB documents and PCB design objects are managed by the PCB Editor and its PCB Object Model. The open PCB document is represented by its IPCB_Board interface and the design objects, in this case the pad and track objects, are represented by IPCB_Pad and IPCB_Track interfaces.

Using the API in scripts

The scripting engine in Altium Designer has built in PCB, Schematic and Workspace Manager APIs as well as a subset of Embarcadero Delphi's Run Time Library. The PCB, Schematic, Workspace Manager Object Models from the scripting engine enable you to write scripts that act on PCB or Schematic documents, or invoke one of the file management routines.

The Object Models from the Altium Designer API are accessible in scripts, so you can code the object and method names (with appropriate parameter values) using one of the several supported scripting languages, such as EnableBasic, Visual Basic, Javascript, TCL and the most commonly-used DelphiScript (which is very much like Embarcadero Delphi).

DelphiScript Example
Procedure PadCount;
Var
 Board : IPCB_Board;
 Pad : IPCB_Primitive;
 Iterator : IPCB_BoardIterator;
 PadNumber : Integer;
Begin
 PadNumber := 0;
 Board := PCBServer.GetCurrentPCBBoard;
 If Board = Nil Then Exit;
 
 Iterator := Board.BoardIterator_Create;
 Iterator.AddFilter_ObjectSet(MkSet(ePadObject));
 Iterator.AddFilter_LayerSet(AllLayers);
 Iterator.AddFilter_Method(eProcessAll);
 
 Pad := Iterator.FirstPCBObject;
 While (Pad <> Nil) Do
 Begin
   Inc(PadNumber);
   Pad := Iterator.NextPCBObject;
 End;
 
 Board.BoardIterator_Destroy(Iterator);
 ShowMessage('Pad Count = ' + IntToStr(PadNumber));
End;

Using the API for server development

The Altium Designer scripting system implements a subset of the complete Altium Designer API and its Object Interfaces. The Altium DXP Developer, used for developing Altium Designer server Extensions, has access to the full Altium Designer API via a set of API SDK source units.

More information

You are reporting an issue with the following selected text and/or image within the active document:
Altium Designer 免费试用
Altium Designer Free Trial
我们开始吧!首先,您或者您的公司已经在使用Altium Designer了吗?

如果您有任何需求,请点击这里联系获取当地办公室销售代表联系方式。.
Copyright © 2019 Altium Limited

既然您在使用Altium Designer,为何仍需要试用?

如果您有任何需求,请点击这里联系获取当地办公室销售代表联系方式。.
Copyright © 2019 Altium Limited

好的,实际上您无需下载一个试用版本。

点击下方按钮下载最新版本的Altium Designer安装包

下载Altium Designer 安装包

如果您有任何需求,请点击这里联系获取当地办公室销售代表联系方式。.
Copyright © 2019 Altium Limited

填写下方表格,获取Altium Designer最新报价。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。

如果您是Altium维保期内客户,您不需要下载试用版本。

如果您不是Altium维保客户,请填写下方表格免费试用。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。

您为何想要试用Altium Designer?

如果您有任何需求,请点击这里联系获取当地办公室销售代表联系方式。.
Copyright © 2019 Altium Limited

那您来对地方了!请填写下方表格申请试用吧。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。

听上去很棒!您知道我们为学生提供了特殊折扣么?欲知详情,请点击这里。.

同时,请填写下方表格申请免费试用吧。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。

好的,您可以下载免费的Altium Designer Viewer查看文档,有效期6个月。

请填写下方表格申请。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。

好棒!创作是一件超酷的事情,我们可以为您提供完美的设计软件。

Upverter是一个社区导向的交流平台,专为您这样的创客量身定做。

点击这里看看吧!

如果您有任何需求,请点击这里联系获取当地办公室销售代表联系方式。.
Copyright © 2019 Altium Limited

好的,您可以下载免费的Altium Designer Viewer查看文档,有效期6个月。

请填写下方表格申请。

点击[获取免费试用],并同意我们的隐私政策。您会接收到来自Altium的资讯,并允许其改变您的通知首选项。