技术参考 - PCB API

您正在阅读的是 16.1. 版本。关于最新版本,请前往 技术参考 - 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 Designer软件订阅的各个级别中包含的功能,以及通过Altium 365平台提供的应用程序所能实现的功能。

如果您在软件中找不到某个讨论过的功能,请联系Altium销售团队以获取更多信息。