Skip to main content
View as Markdown

IPCB_LayerObject interface

A layer of a PCB document, with its layer ID, its name and whether primitives use it.

public interface IPCB_LayerObject

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Derived: IPCB_LayerObject2, IPCB_MechanicalLayer, IPCB_PhysicalLayer

Remarks​

Layer objects come from the layer stacks of the board, for example from IPCB_LayerStack.LayerObject, IPCB_LayerStack_V7.LayerObject, the layer walk of IPCB_LayerStack_V7 (FirstLayer, NextLayer) or an IPCB_LayerObjectIterator from IPCB_LayerStackBase.Iterator. Each kind of layer has its own derived interface, such as IPCB_SignalLayer, IPCB_InternalPlane, IPCB_DielectricLayer and IPCB_MechanicalLayer.

IPCB_LayerStack.LayerObject returns a layer object for any layer of the board, also for a layer that is not in the layer stack, such as a keep-out layer or a mechanical layer.

Properties​

PropertyTypeAccessDescription
LayerDisplayNamestringgetThe name of the layer in a given format.
LayerNamestringget; setThe name of the layer.
UsedByPrimsboolget; setWhether the layer is marked as used by primitives.

LayerDisplayName​

The name of the layer in a given format.

string GetState_LayerDisplayName(TLayerNameDisplayMode argValue);

Type: string · Access: read-only · Index: argValue (TLayerNameDisplayMode): The format. TLayerNameDisplayMode.eLayerNameDisplay_Short and TLayerNameDisplayMode.eLayerNameDisplay_Medium give the short and the medium standard name of the layer; TLayerNameDisplayMode.eLayerNameDisplay_Long gives LayerName.

The accessors are extension methods of IPCB_LayerObjectHelper (using PCB;).

A coverlay layer takes its name from the solder mask layer it is linked to, in every format.

On a rigid-flex board with more than one substack, a mechanical layer of a paired kind that is used in a mechanical layer pair gets a suffix in parentheses: the index of the pair's substack in the short and medium formats, the substack's name in the long format.

LayerName​

The name of the layer.

string GetState_LayerName();
void SetState_LayerName(string argName);

Type: string · Access: read/write

While the stored name is empty, for example after an empty name is set, it is the standard name of the layer. Setting the name has no effect on the layer that is the board's IPCB_Board.RouteToolPathLayer.

UsedByPrims​

Whether the layer is marked as used by primitives.

bool GetState_UsedByPrims();
void SetState_UsedByPrims(bool argValue);

Type: bool · Access: read/write

The value is a stored flag: reading it does not check the board for primitives, and setting it changes only the flag. IPCB_Board.LayerIsUsed reads and sets the same flag for a layer of the board.

Example: Report which mechanical layers of the current board are enabled, displayed and used.

using PCB;

IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
return;
IPCB_LayerStack ls = board.GetState_LayerStack();
if (ls == null)
return;
string s = "";
for (TV6_Layer layer = TV6_Layer.eV6_Mechanical1; layer <= TV6_Layer.eV6_Mechanical16; layer++)
{
var lObject = ls.LayerObject(layer) as IPCB_MechanicalLayer;
if (lObject == null)
continue;
// If a mechanical layer is not enabled (as per the Board Layers and
// Colors dialog) then this layer cannot be displayed nor have any objects on it.
if (!lObject.GetState_MechLayerEnabled())
s = s + lObject.GetState_LayerName() + " is NOT enabled (thus it cannot be displayed nor have any objects on it)." + "\r";
else
{
bool isDisplayed = board.GetState_LayerIsDisplayed(lObject.V7_LayerID());
if (isDisplayed && lObject.GetState_UsedByPrims())
s = s + lObject.GetState_LayerName() + " is displayed and there are objects on it." + "\r";
if (isDisplayed && !lObject.GetState_UsedByPrims())
s = s + lObject.GetState_LayerName() + " is displayed and there are NO objects on it." + "\r";
if (!isDisplayed && lObject.GetState_UsedByPrims())
s = s + lObject.GetState_LayerName() + " is NOT displayed and there are objects on it." + "\r";
if (!isDisplayed && !lObject.GetState_UsedByPrims())
s = s + lObject.GetState_LayerName() + " is NOT displayed and there are NO objects on it." + "\r";
}
}
DXP.Utils.ShowMessage(s);

Methods​

MethodReturnsDescription
IsInLayerStackboolReturns whether the layer is in the layer stack of its board.
LayerStackIPCB_LayerStackBase
V6_LayerIDTV6_LayerReturns the layer ID of the layer as a TV6_Layer value.
V7_LayerIDV7_LayerBaseReturns the layer ID of the layer.

IsInLayerStack​

Returns whether the layer is in the layer stack of its board.

bool IsInLayerStack();

Returns: bool

Returns false for a layer that does not belong to a layer stack.

LayerStack​

No description yet.

IPCB_LayerStackBase LayerStack();

Returns: IPCB_LayerStackBase

Extension method of IPCB_LayerObjectHelper (using PCB;).

V6_LayerID​

Returns the layer ID of the layer as a TV6_Layer value.

TV6_Layer V6_LayerID();

Returns: TV6_Layer

Extension method of IPCB_LayerObjectHelper (using PCB;).

TV6_Layer has values only for mid layers 1 to 30, internal planes 1 to 16 and mechanical layers 1 to 16, and none for dielectric layers; use V7_LayerID for other layers.

V7_LayerID​

Returns the layer ID of the layer.

V7_LayerBase V7_LayerID();

Returns: V7_LayerBase

Extension method of IPCB_LayerObjectHelper (using PCB;).

Returned by​

IPCB_DrillLayerPair.StartLayer, IPCB_DrillLayerPair.StopLayer, IPCB_LayerObjectIterator.LayerObject, IPCB_LayerStack.LayerObject, IPCB_LayerStack.LayerObject_1, IPCB_LayerStackBase.First, IPCB_LayerStackBase.Last, IPCB_LayerStackBase.Next, IPCB_LayerStackBase.Previous, IPCB_MasterLayerStack.CreateLayer, IPCB_MasterLayerStack.InsertAbove, IPCB_MasterLayerStack.InsertBelow, IPCB_MasterLayerStack.InsertOnBottom, IPCB_MasterLayerStack.InsertOnTop, IPCB_MasterLayerStack2.CreateLayerWithId, IPCB_Via.StartLayer, IPCB_Via.StopLayer, IPrintedElectronics.GetLowerDielectricBetweenTwoLayers

Accepted by​

IPCB_Board.LayerPositionInSet, IPCB_LayerStackBase.Count_2, IPCB_LayerStackBase.Iterator_2, IPCB_LayerStackBase.Next, IPCB_LayerStackBase.Previous, IPCB_LayerStackBase.ZBottom, IPCB_LayerStackBase.ZTop, IPCB_MasterLayerStack.DisableLayer, IPCB_MasterLayerStack.EnableLayer, IPCB_MasterLayerStack.InsertAbove, IPCB_MasterLayerStack.InsertBelow, IPCB_MasterLayerStack.InsertOnBottom, IPCB_MasterLayerStack.InsertOnTop, IPCB_MasterLayerStack.RemoveLayer