Technical Reference - PCB API

Вы просматриваете версию 20.1. Для самой новой информации, перейдите на страницу Technical Reference - PCB API для версии 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.
Примечание

Набор доступных функций зависит от вашего уровня доступа к продуктам Altium. Ознакомьтесь с функциями, включенными в различные уровни Подписки на ПО Altium, и функциональными возможностями приложений, предоставляемых платформой Altium 365.

Если вы не видите в своем ПО функцию, описанную здесь, свяжитесь с отделом продаж Altium, чтобы узнать больше.