Technical Reference - PCB API

Now reading version 19. For the latest, read: Technical Reference - PCB API for version 22

Parent page: Altium Designer API Reference

Please note that this documentation was last updated for an older version of Altium Designer. While many of the principles and approaches will remain the same, be aware that interfaces, objects, methods, properties, and the like will have changed since then, and will not reflect the entirety of those found in later versions of the software.

The PCB Application Programming Interface (API) reference details the object interfaces for PCB objects such as PCB documents and PCB design objects.

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.

The PCB API consists of the PCB Object model and the API functions. The PCB Object Model part of the PCB API is made accessible by the PCB Editor.

The PCB design objects and methods are available in all script languages supported by Altium Designer. The PCB design objects are wrapped by their corresponding PCB interfaces which makes it possible to manipulate those objects by scripts and server code.

Object Interfaces

An interface is basically a list of methods that a class declares it implements — that is, each method in the interface is implemented in the corresponding class. Interfaces are declared like classes, but cannot be directly instantiated and do not have their own method definitions.

PCBServer function

To work with PCB design objects, the starting point is to invoke the PCBServer function which returns the IPCB_ServerInterface interface, which represents the PCB Editor. With this interface, all other PCB interfaces can be extracted.

For example to get access to the current PCB document open in Altium Designer, you would invoke the GetCurrentPCBBoard method from the IPCB_ServerInterface interface object.

Example: Obtaining the currently open PCB document.

Board := PCBServer.GetCurrentPCBBoard;
  If Board = Nil then Exit;
TheFilename := Board.FileName;
Main PCB Interfaces
  • The IPCB_Primitive interface is a generic ancestor interface for all PCB design object interfaces.
  • The IPCB_Board interface represents an existing PCB document.
  • The IPCB_ServerInterface interface represents the PCB server object.

Script Examples
There are PCB script examples in the \Examples\Scripts\DelphiScripts\PCB folder which demonstrate the use of PCB interfaces.

References for the PCB API

Separate references for other Altium Designer APIs

PCB Object Model

The PCB Object Model compromises of PCB Object Interfaces and standalone utility functions that allow you to deal with PCB objects from a PCB document in Altium Designer via object interfaces.

An interface is just a means of access to an object in memory. To have access to the PCB server and massage certain PCB design objects, you need to invoke the PCBServer function, which extracts the IPCB_ServerInterface interface.

The IPCB_ServerInterface interface is the main interface and contains many interfaces within. With this interface for example, you can proceed further by iterating for PCB objects on a PCB document.

A simplified PCB Interfaces hierarchy example:
IPCB_Primitive
    IPCB_Group
        IPCB_Net

The IPCB_ServerInterface and IPCB_Board interfaces are two of the main interfaces to deal with when accessing and manipulating a PCB document.

See also
IPCB_ServerInterface
IPCB_BoardOutline
IPCB_Board
IPCB_LayerStack
IPCB_LayerObject
IPCB_InternalPlane
IPCB_DrillLayerPair
IPCB_MechanicalLayerPairs
IPCB_SystemOptions
IPCB_InteractiveRoutingOptions
IPCB_Arc
IPCB_Pad
IPCB_Via
IPCB_Track
IPCB_Connection
IPCB_Embedded
IPCB_Violation
IPCB_Text
IPCB_Fill
IPCB_Coordinate
IPCB_Dimension
IPCB_Component
IPCB_Polygon
IPCB_Net
IPCB_LibComponent
 

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Note

The features available depend on your Altium product access level. Compare features included in the various levels of Altium Designer Software Subscription and functionality delivered through applications provided by the Altium 365 platform.

If you don’t see a discussed feature in your software, contact Altium Sales to find out more.