PCB API Layer Interfaces

Old Content - visit altium.com/documentation

Parent page: Technical Reference - PCB API

New and updated content.

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 IPCB_LayerObject properties
I_ObjectAddress
IsInLayerStack
V6_LayerID
V7_LayerID
LayerStack
Name
UsedByPrims

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

 Procedure SigLayers; Var    Board      : IPCB_Board;    Stack      : IPCB_LayerStack;    LyrObj     : IPCB_LayerObject;    LyrClass   : string;  Begin    // nominate layer class    LyrClass : = eLayerClass_Signal;     Board := PCBServer.GetCurrentPCBBoard;    Stack := Board.LayerStack;     // get first layer in class    LyrObj := Stack.First(LyrClass);     // exit if layer type is not available in stack    If LyrObj = Nil then    Begin       ShowError('Stackup does not have this type of layer.');       exit;    End;     // iterate through layers and display each layer ID & name   Repeat      ShowMessage('LayerID: ' + OleStrToString(LyrObj.V6_LayerID) + '  Name: ' + LyrObj.Name);      LyrObj := Stack.Next(LyrClass, LyrObj);   Until LyrObj = Nil;  End;
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

 Procedure LayerINFO; Var    Board      : IPCB_Board;    Stack      : IPCB_LayerStack_V7;    Lyr        : TLayer;    LyrObj     : IPCB_LayerObject_V7;    OnOff      : string;  Begin    Board := PCBServer.GetCurrentPCBBoard;    Stack := Board.LayerStack_V7;     // Obtain the first layer of the layer stack    LyrObj := Stack.FirstLayer;     while LyrObj <> Nil do    begin       if LyrObj.IsDisplayed[Board] then          OnOff := 'On'       else          OnOff := 'Off';     Lyr := LyrObj.LayerID;  // or use the V6_LayerID function    ShowMessage('Layer ' + OleStrToString(Lyr) + ' is ' + Layer2String(Lyr) + #13#10 + 'The layer display is ' + OnOff);     // Obtain the next layer of the layer stack    LyrObj := Stack.NextLayer(LyrObj);    end; End;
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 Designer 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

 Procedure EnabledMechLayers; Var    Board      : IPCB_Board;    Stack      : IPCB_LayerStack;    mLyrObj    : IPCB_MechanicalLayer;    Lyr        : TLayer;  Begin    Board := PCBServer.GetCurrentPCBBoard;    Stack := Board.LayerStack;     for Lyr := eMechanical1 to eMechanical16 do    begin       mLyrObj := Stack.LayerObject[Lyr];       If mLyrObj.MechanicalLayerEnabled then ShowInfo(mLyrObj.Name);    end; End;

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

 Procedure DielectricInfo; Var     Board      : IPCB_Board;     LayerStack : IPCB_LayerStack;     dObj       : IPCB_DielectricObject;     dType      : TDielectricType;     dTypeS     : string;     Str        : string;  Begin     Board := PCBServer.GetCurrentPCBBoard;     LayerStack := Board.LayerStack;      // Use layer classes to retrieve board's first available dielectric layer.     dObj := LayerStack.First(eLayerClass_Dielectric);      Str := 'Name, Layer Material, Thickness, Dielectric Material, Dielectric' + #13#10;      Repeat       // Retrieve dielectric object type property.       dType := dObj.DielectricType;        // Convert dielectric type to string. Detected case could also be 0,1,2,3.       Case dType Of         eNoDielectric    : dTypeS := 'None';          eCore            : dTypeS := 'Core';         ePrePreg         : dTypeS := 'PrePreg';         eSurfaceMaterial : dTypeS := 'Surface Material';       End;        // Use DielectricObject interface to extract dielectric layer properties       ShowInfo(Str + dObj.Name + ', ' + dTypeS + ', ' +                    FloatToStr(dObj.DielectricHeight / 10000) + 'mil, ' +                    dObj.DielectricMaterial +  ', ' + FloatToStr(dObj.DielectricConstant));        // Call next dielectric layer       dObj := LayerStack.Next(eLayerClass_Dielectric, dObj);     Until dObj = Nil; End;

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

 Procedure ReportDrillPairs; Var     PCBBoard     : IPCB_Board;     i            : Integer;     LayerPairs   : TStringList;     PCBLayerPair : IPCB_DrillLayerPair;     LowLayerObj  : IPCB_LayerObject;     HighLayerObj : IPCB_LayerObject;     LowPos       : Integer;     HighPos      : Integer;     LS           : String;  Begin     PCBBoard := PCBServer.GetCurrentPCBBoard;     If PCBBoard = Nil Then Exit;      // Show number of drill layer pairs on board     ShowInfo('Number of Drill Layer pairs: ' + IntToStr(PCBBoard.DrillLayerPairsCount));      LayerPairs := TStringList.Create;     For i := 0 To PCBBoard.DrillLayerPairsCount - 1 Do     Begin         PCBLayerPair := PCBBoard.LayerPair[i];         LowLayerObj  := PCBBoard.LayerStack.LayerObject[PCBLayerPair.LowLayer];         HighLayerObj := PCBBoard.LayerStack.LayerObject[PCBLayerPair.HighLayer];         LowPos       := PCBBoard.LayerPositionInSet(SignalLayers, LowLayerObj);         HighPos      := PCBBoard.LayerPositionInSet(SignalLayers, HighLayerObj);          If LowPos <= HighPos Then             LayerPairs.Add(LowLayerObj .Name + ' - ' + HighLayerObj.Name)         Else             LayerPairs.Add(HighLayerObj.Name + ' - ' + LowLayerObj .Name);     End;      //Display layer pairs.     LS := '';     For i := 0 to LayerPairs.Count - 1 Do         LS := LS + LayerPairs[i] + #13#10;     ShowInfo('Layer Pairs:'#13#10 + LS);     LayerPairs.Free; End;

IPCB_MechanicalLayerPairs

Overview
In Altium Designer 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

 Procedure AddMechPairs; Var     Board     : IPCB_Board;     MechPairs : IPCB_MechanicalLayerPairs;  Begin     Board := PCBServer.GetCurrentPCBBoard;     If Board = Nil Then Exit;      MechPairs := Board.MechanicalPairs;      ShowInfo('This Board has ' + IntToStr(MechPairs.Count) + ' Mechanical Pairs'               + #13#10 + 'Add a new pair?');     // Pair mechanical layers 10 and 12      MechPairs.AddPair(66, 68);     ShowInfo('Board now has ' + IntToStr(MechPairs.Count ) + ' Mechanical Pairs'               + #13#10 + 'Clear mechanical pairs?');     MechPairs.Clear;     ShowInfo('Board now has ' + IntToStr(MechPairs.Count) + ' Mechanical Pairs'); End;
You are reporting an issue with the following selected text and/or image within the active document: