Parent page: Technical Reference - PCB API
Please note that this documentation was last updated for an older version of Altium NEXUS. 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 API Layer Interfaces reference covers the following interfaces and content:
See also:
Interface inheritance map:
IPCB_LayerObject
. IPCB_MechanicalLayer
. IPCB_PhysicalLayer
. . IPCB_ElectricalLayer
. . . IPCB_LayerObject_V7
. . . IPCB_SignalLayer
. . . IPCB_InternalPlane
. . . . IPCB_InternalPlane_V7
. . IPCB_DielectricLayer
. . . IPCB_DielectricObject
. . . IPCB_SolderMaskLayer
. . IPCB_OverlayLayer
. . IPCB_PasteMaskLayer
.
IPCB_DrillLayerPair
IPCB_MechanicalLayerPairs
IPCB_LayerObject
Overview
The IPCB_LayerObject
interface represents a layer used in a PCB document. Each layer has properties such as layer name and used by primitive, for example.
This interface is returned by the LayerObject
function in the IPCB_LayerStack
interface, and is property in the IPCB_LayerStack_V7
interface.
Methods and properties:
IPCB_LayerObject methods
I_ObjectAddress method
Syntax
Function I_ObjectAddress : TPCBObjectHandle;
Description
The I_ObjectAddress
function retrieves the Pointer handle for the layer object.
IsInLayerStack method
Syntax
Function IsInLayerStack : Boolean;
Description
This function determines if the layer object is in the current layer stack for the PCB document.
V6_LayerID method
Syntax
Function V6_LayerID : TV6_Layer;
Description
The V6_LayerID
function returns the layer object's layer ID within the layer stack.
Example
04 | Stack : IPCB_LayerStack; |
05 | LyrObj : IPCB_LayerObject; |
10 | LyrClass : = eLayerClass_Signal; |
12 | Board := PCBServer . GetCurrentPCBBoard; |
13 | Stack := Board . LayerStack; |
16 | LyrObj := Stack . First(LyrClass); |
21 | ShowError( 'Stackup does not have this type of layer.' ); |
27 | ShowMessage( 'LayerID: ' + OleStrToString(LyrObj . V6_LayerID) + ' Name: ' + LyrObj . Name); |
28 | LyrObj := Stack . Next(LyrClass, LyrObj); |
V7_LayerID method
Syntax
Function V7_LayerID : TV7_Layer;
(IDispatch)
Description
The V7_LayerID
function returns the layer object's layer ID within the layer stack as a TV7_Layer
type.
LayerStack method
Syntax
Function LayerStack : IPCB_LayerStackBase;
Description
This function returns the layer stack, referenced by the IPCB_LayerStackBase
interface, associated with the current layer object. Note that both the IPCB_MasterLayerStack
and IPCB_LayerStack
interfaces inherit methods and properties from the IPCB_LayerStackBase
interface.
IPCB_LayerObject properties
Name property
Syntax
Property Name : TPCBString;
Read/Write syntax
GetState_Name;
SetState_Name;
Description
The Name
property returns a string representing the current layer object name. See line 27 in the V6_LayerID
method example above.
UsedByPrims property
Syntax
Property UsedByPrims : Boolean
;
Read/Write syntax
GetState_UsedByPrims;
SetState_UsedByPrims;
Description
The UsedByPrims
property indicates whether the layer object is used by primitives.
IPCB_LayerObject_V7
Overview
The IPCB_LayerObject_V7
interface, like the IPCB_LayerObject
interface, represents a layer used in a PCB document. Each layer has properties such as layer Name and whether it is used by primitives, for example. This interface is a property of the IPCB_LayerStack_V7
interface, and is returned by methods such as FirstLayer
and NextLayer
.
The IPCB_LayerObject_V7
interface offers the methods and properties of the older, now deprecated, version of the IPCB_LayerObject
interface.
As an alternative interface to the current IPCB_LayerObject
interface, the IPCB_LayerObject_V7
interface therefore offers backward compatibility for legacy scripts. In most cases just a few interface reference changes in the code should return an older script to a fully functional state.
The layer stack for a PCB document, when referenced by the IPCB_LayerStack_V7
interface, only deals with copper based layers such as signal and internal plane layers. Each layer in the layer stack can have dielectric information and layer pairs can be specified. However the LayerObject_V7
interface can provide access to any layer for the PCB board.
IPCB_LayerObject_V7
inherits methods and properties from the IPCB_LayerObject
and IPCB_ElectricalLayer
interfaces.
Methods and properties:
IPCB_LayerObject_V7 methods |
IPCB_LayerObject_V7 properties |
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
^ Above methods inherited from IPCB_LayerObject
Dielectric
LayerID |
Name
UsedByPrims
^ Above methods inherited from IPCB_LayerObject
CopperThickness
^ Above method inherited from IPCB_ElectricalLayer
IsDisplayed |
IPCB_LayerObject_V7 methods
I_ObjectAddress method
Syntax
Function I_ObjectAddress : TPCBObjectHandle;
Description
The I_ObjectAddress
function retrieves the Pointer handle for the layer object.
IsInLayerStack method
Syntax
Function IsInLayerStack : Boolean;
Description
This function determines if the layer object is in the current layer stack for the PCB document.
V6_LayerID method
Syntax
Function V6_LayerID : TV6_Layer;
Description
The V6_LayerID
function returns the layer object's layer ID within the layer stack. This is equivalent to the IPCB_LayerObject_V7.LayerID
method. See line 23 in the below example.
Example
04 | Stack : IPCB_LayerStack_V7; |
06 | LyrObj : IPCB_LayerObject_V7; |
10 | Board := PCBServer . GetCurrentPCBBoard; |
11 | Stack := Board . LayerStack_V7; |
14 | LyrObj := Stack . FirstLayer; |
16 | while LyrObj <> Nil do |
18 | if LyrObj . IsDisplayed[Board] then |
23 | Lyr := LyrObj . LayerID; |
24 | ShowMessage( 'Layer ' + OleStrToString(Lyr) + ' is ' + Layer2String(Lyr) + # 13 # 10 + 'The layer display is ' + OnOff); |
27 | LyrObj := Stack . NextLayer(LyrObj); |
V7_LayerID method
Syntax
Function V7_LayerID : TV7_Layer;
(IDispatch)
Description
The V7_LayerID
function returns the layer object's layer ID within the layer stack as a TV7_Layer
type.
LayerStack method
Syntax
Function LayerStack : IPCB_LayerStackBase;
Description
This function returns the layer stack, referenced by the IPCB_LayerStackBase
interface, associated with the current layer object. Note that both the IPCB_MasterLayerStack
and IPCB_LayerStack
interfaces inherit methods and properties from the IPCB_LayerStackBase
interface.
Dielectric method
Syntax
Function Dielectric : IPCB_DielectricObject;
Description
The Dielectric
function returns the IPCB_DielectricObject
interface for the current layer object, providing access to the object's dielectric properties.
LayerID method
Syntax
Function LayerID : TV6_Layer;
Description
The LayerID
function returns the layer object's layer ID within the layer stack, as a TV6_Layer
or equivalent TLayer
type. See line 23 in the above example.
IPCB_LayerObject_V7 properties
Name property
Syntax
Property Name : TPCBString;
Read/Write syntax
GetState_Name;
SetState_Name;
Description
The Name
property returns a string representing the current layer object name.
UsedByPrims property
Syntax
Property UsedByPrims : Boolean
;
Read/Write syntax
GetState_UsedByPrims;
SetState_UsedByPrims;
Description
The UsedByPrims
property indicates whether the layer object is used by primitives.
CopperThickness property
Syntax
Property CopperThickness : Tcoord
;
Read/Write syntax
GetState_CopperThickness;
SetState_CopperThickness;
Description
The CopperThickness
property returns (or sets) the copper thickness for the current layer object as a Tcood
value type. If needed, use the value conversion methods such as CoodToMils
to change the value type.
IsDisplayed property
Syntax
Property IsDisplayed [Board : IPCB_Board] : Boolean
Read/Write syntax
GetState_IsDisplayed;
SetState_IsDisplayed;
Description
The IsDisplayed
property returns the display state (on/off) of the layer object, as determined by the nominated board interface, Board
. See line 18 in the V6_LayerID method example above.
IPCB_MechanicalLayer
Overview
Altium NEXUS offers 32 general purpose mechanical layers for defining the board layout, placing dimensions on, including fabrication details on, or any other mechanical details the design requires.
Mechanical layers can be obtained by iterating though the layers on a PCB document, and once a layer is determined as mechanical, the layer can be wrapped as a IPCB_MechanicalLayer
interface.
The LayerObject
function from the IPCB_LayerStack
interface (or the LayerObject
property from the IPCB_LayerStack_V7
interface) can be used to fetch all layers using a loop.
The IPCB_MechanicalLayer
interface inherits layers and properties from the IPCB_LayerObject
interface.
Methods and properties
IPCB_MechanicalLayer methods |
IPCB_MechanicalLayer properties |
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
^ Above methods inherited from IPCB_LayerObject |
Name
UsedByPrims
^ Above methods inherited from IPCB_LayerObject
MechanicalLayerEnabled
DisplayInSingleLayerMode
LinkToSheet |
Example
01 | Procedure EnabledMechLayers; |
04 | Stack : IPCB_LayerStack; |
05 | mLyrObj : IPCB_MechanicalLayer; |
09 | Board := PCBServer . GetCurrentPCBBoard; |
10 | Stack := Board . LayerStack; |
12 | for Lyr := eMechanical1 to eMechanical16 do |
14 | mLyrObj := Stack . LayerObject[Lyr]; |
15 | If mLyrObj . MechanicalLayerEnabled then ShowInfo(mLyrObj . Name); |
IPCB_MechanicalLayer methods
I_ObjectAddress method
- see IPCB_LayerObject methods.
IsInLayerStack method
- see IPCB_LayerObject methods.
V6_LayerID method
- see IPCB_LayerObject methods.
V7_LayerID method
- see IPCB_LayerObject methods.
LayerStack method
- see IPCB_LayerObject methods.
IPCB_MechanicalLayer properties
Name property
- see IPCB_LayerObject properties.
UsedByPrims property
- see IPCB_LayerObject properties.
MechanicalLayerEnabled property
Syntax
Property MechanicalLayerEnabled : Boolean;
Read/Write syntax
GetState_MechLayerEnabled;
SetState_MechLayerEnabled;
Description
The MechanicalLayerEnabled
property determines if this mechanical layer is enabled for the current PCB document. Mechanical layers that already have design objects on them cannot be disabled.
LinkToSheet property
Syntax
Property LinkToSheet : Boolean;
Read/Write syntax
GetState_LinkToSheet;
SetState_LinkToSheet;
Description
This property determines if this mechanical layer is linked to the sheet on the PCB document. Once a sheet is linked to the mechanical layer, the sheet is automatically resized to fit the objects on the linked layer when a zoom command is executed.
DisplayInSingleLayerMode property
Syntax
Property DisplayInSingleLayerMode : Boolean;
Read/Write syntax
GetState_DisplayInSingleLayerMode;
SetState_DisplayInSingleLayerMode;
Description
This property determines if the document is displayed in the single layer mode. When set to True the system's single layer mode setting is overridden, so design objects on mechanical layers where the single layer mode is enabled will show up in the single layer mode.
IPCB_DielectricLayer
All methods inherited from the IPCB_DielectricObject
interface — see below.
IPCB_DielectricObject
Overview
The IPCB_DielectricObject
interface represents the dielectric properties for the specified PCB layer.
Dielectric layer objects can be retrieved using the LayerObject
function of the IPCB_LayerStack
interface, then accessed via the IPCB_LayerObject
interface.
The the IPCB_DielectricObject
interface inherits all methods and properties from the the IPCB_DielectricLayer
interface, which in turn inherits from the IPCB_LayerObject
interface. The IPCB_DielectricObject and IPCB_DielectricLayer interfaces offer identical methods and properties.
Methods and properties
IPCB_DielectricObject methods |
IPCB_DielectricObject properties |
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
^ Above methods inherited from IPCB_LayerObject |
Name
UsedByPrims
^ Above methods inherited from IPCB_LayerObject
DielectricMaterial
DielectricType
DielectricConstant
DielectricHeight |
Example
01 | Procedure DielectricInfo; |
04 | LayerStack : IPCB_LayerStack; |
05 | dObj : IPCB_DielectricObject; |
06 | dType : TDielectricType; |
11 | Board := PCBServer . GetCurrentPCBBoard; |
12 | LayerStack := Board . LayerStack; |
15 | dObj := LayerStack . First(eLayerClass_Dielectric); |
17 | Str := 'Name, Layer Material, Thickness, Dielectric Material, Dielectric' + # 13 # 10 ; |
21 | dType := dObj . DielectricType; |
25 | eNoDielectric : dTypeS := 'None' ; |
26 | eCore : dTypeS := 'Core' ; |
27 | ePrePreg : dTypeS := 'PrePreg' ; |
28 | eSurfaceMaterial : dTypeS := 'Surface Material' ; |
32 | ShowInfo(Str + dObj . Name + ', ' + dTypeS + ', ' + |
33 | FloatToStr(dObj . DielectricHeight / 10000 ) + 'mil, ' + |
34 | dObj . DielectricMaterial + ', ' + FloatToStr(dObj . DielectricConstant)); |
37 | dObj := LayerStack . Next(eLayerClass_Dielectric, dObj); |
IPCB_DielectricObject methods
All methods inherited from the IPCB_LayerObject
interface. See IPCB_LayerObject methods.
IPCB_DielectricObject properties
Name property
- see IPCB_LayerObject properties.
UsedByPrims property
- see IPCB_LayerObject properties.
DielectricMaterial property
Syntax
Property DielectricMaterial : TPCBString;
Read/Write syntax
GetState_DielectricMaterial;
SetState_DielectricMaterial;
Description
The DielectricMaterial
property determines the dielectric material type for the current dielectric layer, such as FR-4, Solder Resist, Polyamide etc.
DielectricType property
Syntax
Property DielectricType : TDielectricType;
Read/Write syntax
GetState_DielectricType;
SetState_DielectricType;
Description
The DielectricType
property determines the dielectric type for the current dielectric layer. It returns a TDielectricType
type string such as eCore
or ePrePreg
(or a type number equivalent).
DielectricConstant property
Syntax
Property DielectricConstant : TReal;
Read/Write syntax
GetState_DielectricConstant;
SetState_DielectricConstant;
Description
The DielectricConstant
property defines the dielectric constant rating for the current dielectric layer.
DielectricHeight property
Syntax
Property DielectricHeight : TCoord
Read/Write syntax
GetState_DielectricHeight;
SetState_DielectricHeight;
Description
The DielectricHeight
property determines the dielectric material height (thickness) of the current dielectric layer in Tcood units.
IPCB_SolderMaskLayer
Inherits all methods and properties from the IPCB_DielectricLayer
interface, which inherits from the IPCB_DielectricObject interface.
IPCB_OverlayLayer
Inherits all methods and properties from the IPCB_LayerObject interface.
IPCB_PasteMaskLayer
Inherits all methods and properties from the IPCB_LayerObject interface.
IPCB_SignalLayer
The IPCB_SignalLayer
interface represents a signal layer in the layer stack for a PCB document.
The IPCB_SignalLayer
interface inherits methods and properties from the IPCB_ElectricalLayer
and IPCB_LayerObject
.
Methods and properties
IPCB_SignalLayer methods |
IPCB_SignalLayer properties |
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
^ Above methods inherited from IPCB_LayerObject
|
Name
UsedByPrims
^ Above methods inherited from IPCB_LayerObject
CopperThickness
^ Above method inherited from IPCB_ElectricalLayer
ComponentPlacement |
IPCB_InternalPlane
Overview
This IPCB_InternalPlane
interface represents an internal copper plane used on a PCB document. 16 internal planes are supported, A net can be assigned to each of these layers, or a number of nets can share a power plane by splitting it into two or more isolated areas (a Split Plane)
Pad and via connections to power planes are controlled by the Plane design rules.
The IPCB_InternalPlane
interface is used by the IPCB_LayerStack_V7
interface - the LastInternalPlane
and FirstAvailableInternalPlane
methods. IPCB_InternalPlane
inherits methods and properties from the IPCB_ElectricalLayer
and IPCB_LayerObject
interfaces.
Methods and properties
IPCB_InternalPlane methods |
IPCB_InternalPlane properties |
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
^ Above methods inherited from IPCB_LayerObject |
Name
UsedByPrims
^ Above methods inherited from IPCB_LayerObject
CopperThickness
^ Above method inherited from IPCB_ElectricalLayer
PullBackDistance
NetName |
IPCB_InternalPlane methods
All methods inherited from the IPCB_LayerObject
interface. See IPCB_LayerObject methods.
IPCB_InternalPlane properties
Name property
- see IPCB_LayerObject properties.
UsedByPrims property
- see IPCB_LayerObject properties.
CopperThickness property
Syntax
Property CopperThickness : Tcoord
;
Read/Write syntax
GetState_CopperThickness;
SetState_CopperThickness;
Description
The CopperThickness
property returns (or sets) the copper thickness for the current layer object as a Tcood
value type. If needed, use the value conversion methods such as CoodToMils
to change the value type.
PullBackDistance property
Syntax
Property PullBackDistance : TCoord
;
Read/Write syntax
GetState_PullBackDistance;
SetState_PullBackDistance;
Description
The PullBackDistance
property returns (or sets) the internal plane copper pullback distance, as a Tcood
value type, for the current layer object.
NetName property
Syntax
Property NetName : TPCBString
;
Read/Write syntax
GetState_NetName;
SetState_NetName;
Description
The NetName
property is a string value that defines the net name for the current internal plane layer object.
IPCB_InternalPlane_V7
Inherits all methods and properties from the IPCB_InternalPlane
interface.
IPCB_DrillLayerPair
Overview
The IPCB_DrillLayerPair
interface represents the paired drill layer for the layer stack up for the PCB document.
Notes
The IPCB_DrillLayerPair
interface is a standalone interface.
The IPCB_DrillLayerPair
interface is a DrillLayerPair
property from the IPCB_Board
interface.
DrillLayerPair methods |
DrillLayerPair properties |
I_ObjectAddress
GetState_Description
IsSimilarTo
OrderLayers
|
LowLayer
HighLayer
StartLayer
StopLayer
Board
PlotDrillDrawing
PlotDrillGuide |
Example
01 | Procedure ReportDrillPairs; |
03 | PCBBoard : IPCB_Board; |
05 | LayerPairs : TStringList; |
06 | PCBLayerPair : IPCB_DrillLayerPair; |
07 | LowLayerObj : IPCB_LayerObject; |
08 | HighLayerObj : IPCB_LayerObject; |
14 | PCBBoard := PCBServer . GetCurrentPCBBoard; |
15 | If PCBBoard = Nil Then Exit; |
18 | ShowInfo( 'Number of Drill Layer pairs: ' + IntToStr(PCBBoard . DrillLayerPairsCount)); |
20 | LayerPairs := TStringList . Create; |
21 | For i := 0 To PCBBoard . DrillLayerPairsCount - 1 Do |
23 | PCBLayerPair := PCBBoard . LayerPair[i]; |
24 | LowLayerObj := PCBBoard . LayerStack . LayerObject[PCBLayerPair . LowLayer]; |
25 | HighLayerObj := PCBBoard . LayerStack . LayerObject[PCBLayerPair . HighLayer]; |
26 | LowPos := PCBBoard . LayerPositionInSet(SignalLayers, LowLayerObj); |
27 | HighPos := PCBBoard . LayerPositionInSet(SignalLayers, HighLayerObj); |
29 | If LowPos <= HighPos Then |
30 | LayerPairs . Add(LowLayerObj .Name + ' - ' + HighLayerObj . Name) |
32 | LayerPairs . Add(HighLayerObj . Name + ' - ' + LowLayerObj .Name); |
37 | For i := 0 to LayerPairs . Count - 1 Do |
38 | LS := LS + LayerPairs[i] + # 13 # 10 ; |
39 | ShowInfo( 'Layer Pairs:' # 13 # 10 + LS); |
IPCB_MechanicalLayerPairs
Overview
In Altium NEXUS there are 32 general purpose mechanical layers for defining the board layout, placing dimensions on, including fabrication details on, or any other mechanical details the design requires. The purpose of the IPCB_MechanicalLayerPairs
Interface is to see and manipulate which Mechanical layers are paired to one another.
When a component incorporates objects on one or more Mechanical layers that have been paired, the Layer property of those objects changes when the Layer property of the component is toggled (between the Top and Bottom layers), just like objects on the non-Mechanical layers that have always been paired to one another, such as the Top and Bottom (copper) layers, the Top and Bottom Overlay layers, the Top and Bottom Paste Mask layers, and the Top and Bottom Solder Mask layers.
Notes
The IPCB_MechanicalLayerPairs
interface is a MechanicalPairs
property of the IPCB_Board
interface — IPCB_Board.MechanicalPairs
returns the IPCB_MechanicalLayerPairs
interface.
Invoke the Count
method to obtain the number of mechanical layer pairs for the existing PCB document. The LayerPair[I : Integer]
property defines indexed layer pairs and returns a TMechanicalLayerPair
record of two PCB layers.
Methods and properties
IPCB_MechanicalLayerPairs methods |
IPCB_MechanicalLayerPairs properties |
Clear
Count
AddPair
RemovePair
PairDefined
LayerUsed
FlipLayer
FlipLayerV7
Import_FromParameters
Export_ToParameters |
LayerPair |
Example
01 | Procedure AddMechPairs; |
04 | MechPairs : IPCB_MechanicalLayerPairs; |
07 | Board := PCBServer . GetCurrentPCBBoard; |
08 | If Board = Nil Then Exit; |
10 | MechPairs := Board . MechanicalPairs; |
12 | ShowInfo( 'This Board has ' + IntToStr(MechPairs . Count) + ' Mechanical Pairs' |
13 | + # 13 # 10 + 'Add a new pair?' ); |
15 | MechPairs . AddPair( 66 , 68 ); |
16 | ShowInfo( 'Board now has ' + IntToStr(MechPairs . Count ) + ' Mechanical Pairs' |
17 | + # 13 # 10 + 'Clear mechanical pairs?' ); |
19 | ShowInfo( 'Board now has ' + IntToStr(MechPairs . Count) + ' Mechanical Pairs' ); |