PCB API Layer Stack Interfaces

Now reading version 19. For the latest, read: PCB API Layer Stack Interfaces for version 22

Parent page: Technical Reference - PCB API

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 Layer Stack Interfaces reference covers the following interfaces and content:

See also:

Interface inheritance map:

IPCB_LayerStackBase
.  IPCB_MasterLayerStack
.  IPCB_LayerStack
IPCB_LayerStack_V7

IPCB_MasterLayerStack

Overview

The IPCB_MasterLayerStack interface represents the high-level (master) layer stack for the current PCB document. The Master Layer Stack interface is a property within in the IPCB_Board interface (IPCB_Board.MasterLayerStack) and provides access to the available sub stacks in the overall layer stack structure.

Individual sub stacks are represented by the IPCB_LayerStack interface, and can be nominated using the SubStacks property of the IPCB_MasterLayerStack interface. Sub stacks are managed in Altium Designer's Layer Stack manager and are typically present in Rigid-Flex PCB designs.

The IPCB_MasterLayerStack interface provides methods for accessing and managing sub stacks, including the ability to create and remove sub stacks and query their individual layers.

IPCB_MasterLayerStack inherits methods and properties from the IPCB_LayerStackBase interface.

Methods and properties:

IPCB_MasterLayerStack methods IPCB_MasterLayerStack properties

I_ObjectAddress
ID
StateID
Count
Iterator
First
Last
Next
Previous

^ Above methods inherited from IPCB_LayerStackBase
Board
SubstackCount
CreateLayer
RemoveLayer
InsertOnTop
InsertOnBottom
InsertBelow
InsertAbove
DisableLayer
EnableLayer
GetSubstack
CreateSubstack
RemoveSubstack
Import_FromParameters
Export_ToParameters

Name
IsFlex

^ Above properties inherited from IPCB_LayerStackBase
Substacks
LayerStackStyle

IPCB_MasterLayerStack methods

I_ObjectAddress method

Syntax
Function  I_ObjectAddress : TPCBObjectHandle;
Description
The I_ObjectAddress function retrieves the Pointer handle for the Stack object.

ID method

Syntax
Function  ID : TPCBString;
Description
The ID function returns a unique (and persistent) layer identifier as a string.

StateID method

Syntax
Function  StateID : Integer;
Description
The StateID function returns an integer representing the layer state, which changes on each modification.

Count method

Syntax
Function  Count : Integer;
Description
The Count function returns and integer representing the total number of layers in the currently selected layer stack.

Iterator method

Syntax
Function  Iterator : IPCB_LayerObjectIterator;
Description
The Iterator function retrieves the Layer Object Iterator.

First method

Syntax
Function  First (T: TLayerClassID) : IPCB_LayerObject;
Description
The First function fetches the first layer of type TLayerClassID stored in the current layer stack. The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list.
To fetch the next layer in the layer stack, invoke the Next function (see below). Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Last method

Syntax
Function  Last (T: TLayerClassID) : IPCB_LayerObject;
Description
The Last function fetches the last layer of type TLayerClassID stored in the current layer stack - see the First method above. The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list. Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Next method

Syntax
Function  Next (T: TLayerClassID; ARefLayer: IPCB_LayerObject) : IPCB_LayerObject;
Description
The Next function fetches the next layer of type TLayerClassID stored in the current layer stack, relative to the nominated ARefLayer object (typically the current layer). The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list.
To fetch the previous layer in the layer stack, invoke the Previous function (see example in the IPCB_LayerStack entry). Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Previous method

Syntax
Function Previous (T : TLayerClassID; ARefLayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The Previous function fetches the Previous layer of type TLayerClassID stored in the current layer stack, relative to the nominated ARefLayer object (typically the current layer). The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list.
Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Board method

Syntax
Function  Board : IPCB_Board;
Description
The Board function returns the current PCB document (represented by the IPCB_Board interface) associated with the Master Layer stack.

SubstackCount method

Syntax
SubstackCount : Integer;
Description
The SubstackCount function returns the number of sub stacks in the Master Layer stack as an integer.
Example

// Use of IPCB_MasterLayerStack interface to show Sub Stack information:

Procedure SubStackInfo;
Var
  Board       : IPCB_Board;
  masterStack : IPCB_MasterLayerStack;
  subStack    : IPCB_LayerStack;

Begin
  Board := PCBServer.GetCurrentPCBBoard;
  masterStack := Board.MasterLayerStack;
  subStack := masterStack.Substacks[0]; // nominate first substack: 0

  ShowInfo('Number of sub stacks: ' + OleStrToString(masterStack.SubstackCount));
  ShowInfo('Layers in first sub stack: ' + OleStrToString(subStack.Count));
  ShowInfo('Is a flex layer: ' + OleStrToString(subStack.IsFlex));

// if available, select second substack: 1
  if masterStack.SubstackCount > 1 then
  begin
    subStack := masterStack.Substacks[1];
    ShowInfo('Layers in second sub stack: ' + OleStrToString(subStack.Count));
    ShowInfo('Is a flex layer: ' + OleStrToString(subStack.IsFlex));
  end
  else Exit;

End;
CreateLayer method

Syntax
Function  CreateLayer (ALayer : TV7_Layer) : IPCB_LayerObject;
Description
The CreateLayer function creates a new layer object, ALayer. It returns the layer object, represented by the IPCB_LayerObject interface.

RemoveLayer method

Syntax
Function  RemoveLayer (Layer : IPCB_LayerObject) : Boolean;
Description
The RemoveLayer function removes the layer object, nominated by Layer, from the stack.

InsertOnTop method

Syntax
Function  InsertOnTop (ALayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The InsertOnTop function inserts a new layer object, nominated by ALayer, at the top of the current layer stack.

InsertOnBottom method

Syntax
Function  InsertOnBottom (ALayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The InsertOnBottom function inserts a new layer object, nominated by ALayer, at the bottom of the current layer stack.

InsertBelow method

Syntax
Function  InsertBelow (ARefLayer, ALayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The InsertBelow function inserts a new layer object, nominated by ALayer, below the existing stack layer nominated by ARefLayer.

InsertAbove method

Syntax
Function  InsertAbove (ARefLayer, ALayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The InsertAbove function inserts a new layer object, nominated by ALayer, above the existing stack layer nominated by ARefLayer.

DisableLayer method

Syntax
Procedure DisableLayer (ASubstack : IPCB_LayerStack; ALayer : IPCB_LayerObject);
Description
The DisableLayer function disables layer ALayer in the sub stack nominated by ASubStack.

EnableLayer method

Syntax
Procedure EnableLayer (ASubstack : IPCB_LayerStack; ALayer : IPCB_LayerObject);
Description
The EnableLayer function enables layer ALayer in the sub stack nominated by ASubStack.

GetSubstack method

Syntax
Function  GetSubstack (ASubstackID : TPCBString) : IPCB_LayerStack;
Description
The GetSubstack function retrieves a sub stack nominated by the ID ASubstackID, which is represented by the IPCB_LayerStack interface.

CreateSubstack method

Syntax
Function  CreateSubstack : IPCB_LayerStack;
Description
The CreateSubstack function creates a new layer sub stack and returns the stack object, represented by the IPCB_LayerObject interface.

RemoveSubstack method

Syntax
Function  RemoveSubstack (Substack : IPCB_LayerStack) : Boolean;
Description
The RemoveSubstack function removes the layer sub stack nominated by Substack.

Import_FromParameters method

Syntax
Procedure Import_FromParameters (Params : PChar);
Description
The Import_FromParameters procedure imports the stack parameters as defined by Params.

Export_ToParameters method

Syntax
Procedure Export_ToParameters (Params : PChar);
Description
The Import_FromParameters procedure exports the stack parameters as defined by Params.

IPCB_MasterLayerStack 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 name.

IsFlex property

Syntax
Property  IsFlex : Boolean;
Read/Write syntax
GetState_IsFlex
SetState_IsFlex;

Description
The IsFlex property is True if the layer is designated as Flex, or False for a Rigid layer.
Example
See lines 16 and 23 in the example below.

Substacks property

Syntax
Property  Substacks[Index : Integer] : IPCB_LayerStack;
Read syntax
GetState_Substacks;
Description
The Substacks property indicates a specific sub stack under the Master Layer Stack, and returns the IPCB_LayerStack representing that layer stack. This is 0 for the first sub stack (typically a Rigid layer stack) then 1 for the following sub stack (say a Flex layer stack), and so on.
Example

// Use of IPCB_MasterLayerStack interface to show Sub Stack information:

Procedure SubStackInfo;
Var
  Board       : IPCB_Board;
  masterStack : IPCB_MasterLayerStack;
  subStack    : IPCB_LayerStack;

Begin
  Board := PCBServer.GetCurrentPCBBoard;
  masterStack := Board.MasterLayerStack;
  subStack := masterStack.Substacks[0]; // nominate first substack: 0

  ShowInfo('Number of sub stacks: ' + OleStrToString(masterStack.SubstackCount));
  ShowInfo('Layers in first sub stack: ' + OleStrToString(subStack.Count));
  ShowInfo('Is a flex layer: ' + OleStrToString(subStack.IsFlex));

// if available, select second substack: 1
  if masterStack.SubstackCount > 1 then
  begin
    subStack := masterStack.Substacks[1];
    ShowInfo('Layers in second sub stack: ' + OleStrToString(subStack.Count));
    ShowInfo('Is a flex layer: ' + OleStrToString(subStack.IsFlex));
  end
  else Exit;

End;
LayerStackStyle property

Syntax
Property  LayerStackStyle : TLayerStackStyle;
Read/Write syntax
GetState_LayerStackStyle;
SetState_LayerStackStyle;

Description
The LayerStackStyle property returns the current layer style as the TLayerStackStyle type.

IPCB_LayerStack

Overview
The IPCB_LayerStack interface represents a layer stack in the current PCB document. This Layer Stack interface is a property within the IPCB_Board interface. For PCB designs with more that one layer stack (say, Rigid-Flex board designs) use the IPCB_MaterLayerStack interface to select or directly access the available layer stacks.

In essence, the IPCB_LayerStack interface represents the board layer stack and therefore only has layers used in the board construction, such as copper based and overlay layers. However the interface's LayerObject function (with a passed Layer parameter) can be used to obtain a specific PCB layer for the PCB document.

A predefined layer class can be nominated when iterating through the stack, such as eLayerClass_Mechanical or eLayerClass_SolderMask. To query the layers of a particular class, say Mechanical layers, the class type is passed to the First, Next, Previous, Last functions of the IPCB_LayerStack interaface to iterate through the mechanical layers - IPCB_LayerStack.First(eLayerClass_Mechanical);

Notes
Depending on its type, each layer can be represented as a IPCB_LayerObject, IPCB_InternalPlane, IPCB_DrillLayerPair, IPCB_MechanicalLayerPairs, etc interface. A layer can also have dielectric properties which are represented by the IPCB_DielectricObject interface.
The IPCB_LayerStack interface inherits methods and properties from the IPCB_LayerStackBase interface.

IPCB_LayerStack methods IPCB_LayerStack properties
I_ObjectAddress
ID
StateID
Count
Iterator
First
Last
Next
Previous

^ Above methods inherited from IPCB_LayerStackBase
Board
LayerObject
DielectricTop
DielectricBottom
Name
IsFlex

^ Above properties inherited from IPCB_LayerStackBase
ShowDielectricTop
ShowDielectricBottom

IPCB_LayerStack methods

I_ObjectAddress method

Syntax
Function  I_ObjectAddress : Pointer TPCBObjectHandle;
Description
The I_ObjectAddress function retrieves the Pointer handle for the Stack object.

ID method

Syntax
Function  ID : TPCBString;
Description
The ID function returns a unique (and persistent) layer identifier as a string.

StateID method

Syntax
Function  StateID : Integer;
Description
The StateID function returns an integer representing the layer state, which changes on each modification.

Count method

Syntax
Function  Count : Integer;
Description
The Count function returns and integer representing the total number of layers in the layer stack.

Iterator method

Syntax
Function  Iterator : IPCB_LayerObjectIterator;
Description
The Iterator function retrieves the Layer Object Iterator.

First method

Syntax
Function  First (T: TLayerClassID) : IPCB_LayerObject;
Description
The First function fetches the first layer of type TLayerClassID stored in the layer stack. The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type type for the full class list.
To fetch the next layer in the layer stack, invoke the Next function. Note that the layer stack stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.
Example

// Use of IPCB_LayerStack interface to show available layers by class

{----- for reference ------ 
TLayerClassID:
  eLayerClass_All
  eLayerClass_Mechanical
  eLayerClass_Physical
  eLayerClass_Electrical
  eLayerClass_Dielectric
  eLayerClass_Signal
  eLayerClass_InternalPlane
  eLayerClass_SolderMask
  eLayerClass_Overlay
  eLayerClass_PasteMask
---------------------------}

Procedure LayerInfo;
Var
  Board      : IPCB_Board;
  Stack      : IPCB_LayerStack;
  LyrObj     : IPCB_LayerObject;
  LyrClass   : string;

Begin
  // layer class type nominated (see TLayerClassID list above).
  LyrClass : = eLayerClass_Signal;

  Board := PCBServer.GetCurrentPCBBoard;
  Stack := Board.LayerStack;

  // get first layer of the class type.
  LyrObj := Stack.First(LyrClass);

  // exit if layer type is not available in stack
  If LyrObj = Nil then Exit;

  // iterate through layers and display each layer name
  Repeat
    ShowMessage(LyrObj.Name);
    LyrObj := Stack.Next(LyrClass, LyrObj);
  Until LyrObj = Nil;

End;
Last method

Syntax
Function  Last (T: TLayerClassID) : IPCB_LayerObject;
Description
The Last function fetches the last layer of type TLayerClassID stored in the layer stack - see the First method above. The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list. Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Next method

Syntax
Function  Next (T: TLayerClassID; ARefLayer: IPCB_LayerObject) : IPCB_LayerObject;
Description
The Next function fetches the next layer of type TLayerClassID stored in the layer stack, relative to the nominated ARefLayer object (typically the current layer). The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list. Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Previous method

Syntax
Function  Previous (T : TLayerClassID; ARefLayer : IPCB_LayerObject) : IPCB_LayerObject;
Description
The Previous function fetches the Previous layer of type TLayerClassID stored in the layer stack, relative to the nominated ARefLayer object (typically the current layer). The TLayerClassID type includes layers classes such as eLayerClass_Signal for all signal layers in the stack, eLayerClass_Overlay for overlay layers in the stack, and so on. See the TLayerClassID type for the full class list.
Note that the layer stack only stores the physical layers for the board design, such as signal, dielectric and overlay layers, etc.

Board method

Syntax
Function  Board : IPCB_Board;
Description
This function returns the PCB document that the layer stack is associated with, which is represented by the IPCB_Board interface.

LayerObject method

Syntax
Function  LayerObject(ALayer : TLayer) : IPCB_LayerObject;
Description
The LayerObject function retrieves the layer object interface (IPCB_LayerObject) for the specified layer, ALayer of TLayer type.
Example

/Use of LayerObject method to display specific layers

Procedure ShowMechLayers;
Var
   Board      : IPCB_Board;
   Stack      : IPCB_LayerStack;
   LyrObj     : IPCB_LayerObject;
   Lyr        : TLayer;

Begin
   Board := PCBServer.GetCurrentPCBBoard;
   Stack := Board.LayerStack;

   for Lyr := eMechanical1 to eMechanical16 do
   begin
      LyrObj := Stack.LayerObject[Lyr];
      If LyrObj.MechanicalLayerEnabled then ShowInfo(LyrObj.Name);
   end;
End;
DielectricTop method

Syntax
Function  DielectricTop : IPCB_SolderMaskLayer;
Description
The DielectricTop function returns the stack's top solder layer (eTopSolder), referenced by the IPCB_SolderMaskLayer interface.
Example

Procedure TopDielectricMaterial;
Var
    Board      : IPCB_Board;
    Stack      : IPCB_LayerStack;
    TopDielectric : IPCB_SolderMaskLayer;

Begin
   Board := PCBServer.GetCurrentPCBBoard;
   Stack := Board.LayerStack;
   TopDielectric := Stack.DielectricTop;

   ShowMessage(TopDielectric.DielectricMaterial);
End;
DielectricBottom method

Syntax
Function  DielectricBottom : IPCB_SolderMaskLayer;
Description
The DielectricBottom function returns the stack's bottom solder layer (eBottomSolder), referenced by the IPCB_SolderMaskLayer interface. See example above.

IPCB_LayerStack 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 name.

IsFlex property

Syntax
Property  IsFlex : Boolean;
Read/Write syntax
GetState_IsFlex
SetState_IsFlex;

Description
The IsFlex property is True if the layer is designated as Flex, or False for a Rigid layer.

ShowDielectricTop property

Syntax
Property  ShowDielectricTop : Boolean;
Read/Write syntax
GetState_ShowTopDielectric;
SetState_ShowTopDielectric;

Description
This property enables or disables the dielectric layer for the top solder layer.

ShowDielectricBottom property

Syntax
Property  ShowDielectricBottom : Boolean
Read/Write syntax
GetState_ShowBotDielectric;
SetState_ShowBotDielectric;

Description
This property enables or disables the dielectric layer for the bottom layer.

IPCB_LayerStack_V7

Overview
Both the IPCB_LayerStack_V7 and IPCB_LayerStack interfaces represent the layer stack for the current PCB document, but offer different sets of methods and properties where:

  • IPCB_LayerStack caters for PCB designs that make use of the Altium Designer's current Layer and Stack capabilities such as Flex board construction, Layer classes and large layer counts.
  • IPCB_LayerStack_V7 offers the methods and properties of the older, now deprecated, version of the IPCB_LayerStack interface. In essence, this interface is constrained to copper based layers.

As an alternative interface to the current IPCB_LayerStack interface, the IPCB_LayerStack_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.

Like the IPCB_LayerStack interface, the IPCB_LayerStack_V7 interface is a property within in the IPCB_Board interface.

The IPCB_LayerStack_V7 interface represents the basic layer stack and therefore only retrieves copper based layers such as top, mids, and bottom layers. The LayerObject property with a passed TLayer parameter can be used to obtain any PCB layer for the PCB document.

To query or iterate through existing copper layers (signal layers etc) within the layer stack, the interface's FirstLayer and NextLayer properties can be used - along with the PreviousLayer and LastLayer methods where needed.

Notes
Each layer can be represented as a IPCB_LayerObject, IPCB_InternalPlane, IPCB_DrillLayerPair or IPCB_MechanicalLayerPairs interface.
A layer can have dielectric properties which is represented by a IPCB_DielectricObject interface.
To have access to other layers of the PCB document, use the LayerObject property of the IPCB_LayerStack_V7 interface.

IPCB_LayerStack_V7 methods IPCB_V7_LayerStack properties
FirstLayer
NextLayer
PreviousLayer
LastLayer
FirstAvailableSignalLayer
FirstAvailableInternalPlane
LastInternalPlane
SignalLayerCount
InsertLayer
RemoveFromStack
InsertInStackBelow
InsertInStackAbove
LayersInStackCount
GetState_LayerStackStyle
SetState_LayerStackStyle
Board
LayerObject
LayerObject_V7
DielectricBottom
DielectricTop

ShowDielectricBottom
ShowDielectricTop

IPCB_LayerStack_V7 methods

FirstLayer method

Syntax
Function  FirstLayer : IPCB_LayerObject_V7;
Description
The Firstlayer function fetches the first layer stored in the layer stack for the PCB document. To fetch the next layer in the layer stack, invoke the NextLayer method. Note that the basic layer stack only stores signal and internal (copper based) layers, so the first layer will be the Top Layer.
Example

// Prodedure LegacyLayerInfo

Var
    PCBBoard      : IPCB_Board;
    TheLayerStack : IPCB_LayerStack_V7;
    i             : Integer;
    LayerObj      : IPCB_LayerObject;
    LS            : String;
Begin
    PCBBoard := PCBServer.GetCurrentPCBBoard;
    If PCBBoard = Nil Then Exit;
 
    TheLayerStack := PCBBoard.LayerStack_V7;
    If TheLayerStack = Nil Then Exit;
    LS       := '';
    LayerObj := TheLayerStack.FirstLayer;
    Repeat
        LS       := LS + Layer2String(LayerObj.LayerID) + #13#10;
        LayerObj := TheLayerStack.NextLayer(LayerObj);
    Until LayerObj = Nil;
    ShowInfo('The Layer Stack has :'#13#10 + LS);
End;
NextLayer method

Syntax
Function  NextLayer(L : IPCB_LayerObject_V7) : IPCB_LayerObject_V7;
Description
The NextLayer function fetches the next layer stored in the PCB document's layer stack, relative to the passed layer L. In practice, the NextLayer method is normally used after the FirstLayer function has been invoked, so layer L is that first retrieved layer - see line 19 in the above example. Note that the layer stack only stores signal and internal (copper based) layers.

PreviousLayer method

Syntax
Function  PreviousLayer(L : IPCB_LayerObject_V7) : IPCB_LayerObject_V7;
Description
The PreviousLayer function fetches the previous layer stored in the PCB document's layer stack, relative to the passed layer L.

LastLayer method

Syntax
Function LastLayer : IPCB_LayerObject_V7;
Description
The LastLayer function fetches the last layer stored in the layer stack for the PCB document. Note that the basic layer stack only stores signal and internal (copper based) layers, so the last layer will usually be the Bottom Layer.

FirstAvailableSignalLayer method

Syntax
Function  FirstAvailableSignalLayer : IPCB_LayerObject_V7;
Description
This function retrieves the first available signal layer from the layer stack. The IPCB_LayerStack_V7 interface only offers stores copper based layers such as signal and internal plane layers.

FirstAvailableInternalPlane method

Syntax
Function  FirstAvailableInternalPlane : IPCB_InternalPlane_V7;
Description
This function retrieves the first available internal plane object interface for the PCB document.

LastInternalPlane method

Syntax
Function  LastInternalPlane : IPCB_InternalPlane_V7;
Description
This function retrieves the last internal plane from the layer stack if it exists. If there is no internal planes in the layer stack, the function will return a Nil value.

SignalLayerCount method

Syntax
Function SignalLayerCount : Integer;
Description
This function returns the number of signal layers in the layer stack for the PCB document. See the InsertLayer example below.

InsertLayer method

Syntax
Procedure InsertLayer(L : TV6_TLayer);
Description
The InsertLayer procedure inserts a layer in the stack on the type specified by L. The corresponding RemoveFromStack method removes a specified layer object.
Example

Procedure AddRemoveLayer;
Var
   Board      : IPCB_Board;
   Stack      : IPCB_LayerStack_V7;
   LyrObj     : IPCB_LayerObject;

Begin

   Board := PCBServer.GetCurrentPCBBoard;
   Stack := Board.LayerStack_V7;

   ShowInfo('Signal layer count = ' + IntToStr(Stack.SignallayerCount) + #13#10 + 'Inserting a Mid Layer...');

   Stack.InsertLayer(eV6_MidLayer10);
   LyrObj := Stack.LayerObject(eV6_MidLayer10);  // or pass eMidlayer10

   ShowInfo('New Layer is ' + LyrObj.Name + #13#10 +'Signal layer count = ' + IntToStr(Stack.SignallayerCount));

   ShowInfo('Removing ' + LyrObj.Name);
   Stack.RemoveFromStack(LyrObj);
   ShowInfo('Signal layer count = ' + IntToStr(Stack.SignallayerCount));
End;
RemoveFromStack method

Syntax
Procedure  RemoveFromStack (L : IPCB_LayerObject_V7)
Description
The RemoveFromStack procedure removes the layer object specified by L from the stack. See line 20 in the above example.

InsertInStackBelow method

Syntax
Procedure  InsertInStackBelow (RefL : IPCB_LayerObject_V7, L : IPCB_LayerObject_V7);
Description
The InsertInStackBelow procedure inserts layer object L below the existing layer RefL in the stack.

InsertInStackAbove method

Syntax
Procedure  InsertInStackAbove (RefL : IPCB_LayerObject_V7, L : IPCB_LayerObject_V7);
Description
The InsertInStackAbove procedure inserts layer object L above the existing layer RefL in the stack.

LayersInStackCount method

Syntax
Function  LayersInStackCount : Integer;
Description
This function returns the number of layers in the stack for the PCB document. See also the SignalLayerCount method.

GetState_LayerStackStyle method

Syntax
Function  GetState_LayerStackStyle : TLayerStackStyle;
Description
This function returns the style the current layer stack as a TLayerStackStyle type - Layer Paris, Build-up etc.  See also the  SetState_LayerStackStyle method below.

SetState_LayerStackStyle method

Syntax
Procedure  SetState_LayerStackStyle (SS : TLayerStackStyle);
Description
This procedure sets the current layer stack style as passed by SS, of the TLayerStackStyle type - Layer Paris, Build-up etc.

IPCB_LayerStack_V7 properties

Board property

Syntax
Property Board : IPCB_Board;
Read syntax
GetState_Board;
Description
This property returns the PCB document, represented by the IPCB_Board interface, associated with the layer stack.

LayerObject property

Syntax
Property  LayerObject [L : TV6_Layer] : IPCB_LayerObject_V7;
Read syntax
GetState_LayerObject;
Description
The LayerObject property retrieves the layer object interface for the specified layer L of the TV6_TLayer type. It is a read only property. See the InsertLayer method example above.
Notes
In scripting TLayer is generally equivalent to TV6_Layer, so in the above syntax for example, a specified type of eBottomLayer will producuce the same result as eV6_BottomLayer.

LayerObject_V7 property

Syntax
Property  LayerObject_V7 [L : TLayer] : IPCB_LayerObject_V7;
Read syntax
GetState_LayerObject_V7;
Description
The LayerObject_V7 property retrieves the layer object interface for the specified layer L of TLayer type. It is a read only property.
Example

// Returns Bottom Layer (layer  32) from stack.

Procedure FetchBottomLayer;
Var
   Board      : IPCB_Board;
   Stack      : IPCB_LayerStack_V7;
   LyrObj     : IPCB_LayerObject_V7;

Begin
   Board := PCBServer.GetCurrentPCBBoard;
   Stack := Board.LayerStack_V7;

   LyrObj := Stack.LayerObject_V7(32);
   ShowInfo(Layer2String(LyrObj.LayerID));
End;
DielectricBottom property

Syntax
Property  DielectricBottom : IPCB_DielectricObject;
Read syntax
GetState_DielectricBottom;
Description
This property returns the IPCB_DielectricObject interface associated with the dielectric information for the bottom layer of the layer stack.

DielectricTop property

Syntax
Property  DielectricTop : IPCB_DielectricObject;
Read syntax
GetState_DielectricTop;
Description
This property returns the IPCB_DielectricObject interface associated with the dielectric information for the top layer of the layer stack.

ShowDielectricBottom property

Syntax
Property  ShowDielectricBottom : Boolean
Read/Write syntax
GetState_ShowBotDielectric
SetState_ShowBotDielectric;

Description
This property enables or disables the dielectric layer for the bottom layer.

ShowDielectricTop property

Syntax
Property  ShowDielectricTop : Boolean
Read/Write syntax
GetState_ShowTopDielectric
SetState_ShowTopDielectric;

Description
This property enables or disables the dielectric layer for the top layer.

 

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.