
# IPCB_DrillLayerPair interface

A drill layer pair of a PCB document, the two layers between which holes are drilled, together with the kind of drilling ([`TDrillLayerPairType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TDrillLayerPairType.md)).

```csharp
public interface IPCB_DrillLayerPair
```

**Namespace:** PCB · **Assembly:** Altium.SDK.Interfaces

## Remarks

The pairs of a board are read with [`IPCB_Board.LayerPair`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#layerpair), at indexes 0 to [`IPCB_Board.DrillLayerPairsCount`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#drilllayerpairscount) - 1, or looked up by their layers and type with [`IPCB_Board.LayerPairByPairEx`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#layerpairbypairex).

## Example

Show the current layer and the drill layer pairs of the current board.

```csharp
using System.Collections.Generic;
using PCB;

IPCB_Board pcbBoard = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (pcbBoard == null)
    return;
// Show the current layer
DXP.Utils.ShowInfo("Current Layer: " + EDP.Utils.LayerToString(new V7_Layer(pcbBoard.GetState_CurrentLayer())), "Layers");

var signalLayersAndInternalPlanes = new TV6_LayerSet();
signalLayersAndInternalPlanes.UnionWith(PCBConstant.V6SignalLayersSet);
signalLayersAndInternalPlanes.UnionWith(PCBConstant.V6InternalPlanesSet);

var layerPairs = new List<string>();
for (int i = 0; i < pcbBoard.GetState_DrillLayerPairsCount(); i++)
{
    IPCB_DrillLayerPair pcbLayerPair = pcbBoard.GetState_LayerPair(i);
    IPCB_LayerObject lowLayerObj = pcbBoard.GetState_LayerStack().LayerObject(pcbLayerPair.GetState_LowLayer());
    IPCB_LayerObject highLayerObj = pcbBoard.GetState_LayerStack().LayerObject(pcbLayerPair.GetState_HighLayer());
    int lowPos = pcbBoard.LayerPositionInSet(signalLayersAndInternalPlanes, lowLayerObj);
    int highPos = pcbBoard.LayerPositionInSet(signalLayersAndInternalPlanes, highLayerObj);
    if (lowPos <= highPos)
        layerPairs.Add(lowLayerObj.GetState_LayerName() + " - " + highLayerObj.GetState_LayerName());
    else
        layerPairs.Add(highLayerObj.GetState_LayerName() + " - " + lowLayerObj.GetState_LayerName());
}
//Display layer pairs.
string ls = "";
for (int i = 0; i < layerPairs.Count; i++)
    ls = ls + layerPairs[i] + "\r\n";
DXP.Utils.ShowInfo("Layer Pairs:\r\n" + ls, "Layers");
```

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [Board](#board) | [IPCB_Board](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md) | get | The board that owns the pair. |
| [Description](#description) | `string` | get | A text description of the pair, the names of its two layers separated by " - ". |
| [DrillLayerPairType](#drilllayerpairtype) | [TDrillLayerPairType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TDrillLayerPairType.md) | get | The kind of drilling the pair describes, such as regular drilling, micro-via drilling, backdrilling or counter holes. |
| [HighLayer](#highlayer) | [TV6_Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TV6_Layer.md) | get; set | One end layer of the pair; together with [`LowLayer`](#lowlayer) it defines the layers the drilling spans. |
| [IsBackdrill](#isbackdrill) | `bool` | get; set | Whether the pair is a backdrill pair. |
| [LowLayer](#lowlayer) | [TV6_Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TV6_Layer.md) | get; set | One end layer of the pair; together with [`HighLayer`](#highlayer) it defines the layers the drilling spans. |
| [PlotDrillDrawing](#plotdrilldrawing) | `bool` | get; set | The pair's drill drawing plot setting. |
| [PlotDrillGuide](#plotdrillguide) | `bool` | get; set | The pair's drill guide plot setting. |
| [StartLayer](#startlayer) | [IPCB_LayerObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerObject.md) | get | The upper of the pair's two layers in the layer stack. |
| [StopLayer](#stoplayer) | [IPCB_LayerObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerObject.md) | get | The lower of the pair's two layers in the layer stack. |

### Board

The board that owns the pair.

```csharp
IPCB_Board GetState_Board();
```

**Type:** [IPCB_Board](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md) · **Access:** read-only

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

### Description

A text description of the pair, the names of its two layers separated by " - ".

```csharp
string GetState_Description();
```

**Type:** `string` · **Access:** read-only

For a pair whose [`DrillLayerPairType`](#drilllayerpairtype) is not `TDrillLayerPairType.Regular`, the text starts with a marker of the type. For a counter-hole pair the description is "Counterholes Top" or "Counterholes Bottom" instead.

### DrillLayerPairType

The kind of drilling the pair describes, such as regular drilling, micro-via drilling, backdrilling or counter holes.

```csharp
TDrillLayerPairType GetState_DrillLayerPairType();
```

**Type:** [TDrillLayerPairType](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TDrillLayerPairType.md) · **Access:** read-only

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

Setting [`IsBackdrill`](#isbackdrill) changes this value.

### HighLayer

One end layer of the pair; together with [`LowLayer`](#lowlayer) it defines the layers the drilling spans.

```csharp
TV6_Layer GetState_HighLayer();
void SetState_HighLayer(TV6_Layer argL);
```

**Type:** [TV6_Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TV6_Layer.md) · **Access:** read/write

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

Assigning a value does not reorder the two layers; [`OrderLayers`](#orderlayers) makes [`LowLayer`](#lowlayer) the upper of them. [`StartLayer`](#startlayer) and [`StopLayer`](#stoplayer) return the upper and the lower layer, whichever way round [`LowLayer`](#lowlayer) and `HighLayer` are.

### IsBackdrill

Whether the pair is a backdrill pair.

```csharp
bool GetState_IsBackdrill();
void SetState_IsBackdrill(bool argValue);
```

**Type:** `bool` · **Access:** read/write

The value is derived from [`DrillLayerPairType`](#drilllayerpairtype): it is true for `TDrillLayerPairType.Backdrill` and `TDrillLayerPairType.CounterHole`. Setting it to true sets [`DrillLayerPairType`](#drilllayerpairtype) to `TDrillLayerPairType.Backdrill`; setting it to false changes `TDrillLayerPairType.Backdrill` to `TDrillLayerPairType.Regular` and leaves any other type unchanged, so on a `TDrillLayerPairType.CounterHole` pair `IsBackdrill` stays true.

### LowLayer

One end layer of the pair; together with [`HighLayer`](#highlayer) it defines the layers the drilling spans.

```csharp
TV6_Layer GetState_LowLayer();
void SetState_LowLayer(TV6_Layer argL);
```

**Type:** [TV6_Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TV6_Layer.md) · **Access:** read/write

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

Assigning a value does not reorder the two layers; [`OrderLayers`](#orderlayers) makes `LowLayer` the upper of them. [`StartLayer`](#startlayer) and [`StopLayer`](#stoplayer) return the upper and the lower layer, whichever way round `LowLayer` and [`HighLayer`](#highlayer) are.

### PlotDrillDrawing

The pair's drill drawing plot setting.

```csharp
bool GetState_PlotDrillDrawing();
void SetState_PlotDrillDrawing(bool argValue);
```

**Type:** `bool` · **Access:** read/write

### PlotDrillGuide

The pair's drill guide plot setting.

```csharp
bool GetState_PlotDrillGuide();
void SetState_PlotDrillGuide(bool argValue);
```

**Type:** `bool` · **Access:** read/write

### StartLayer

The upper of the pair's two layers in the layer stack.

```csharp
IPCB_LayerObject GetState_StartLayer();
```

**Type:** [IPCB_LayerObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerObject.md) · **Access:** read-only

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

### StopLayer

The lower of the pair's two layers in the layer stack.

```csharp
IPCB_LayerObject GetState_StopLayer();
```

**Type:** [IPCB_LayerObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerObject.md) · **Access:** read-only

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

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [AddToSubstack](#addtosubstack) | `void` | Adds the pair to the layer stack with the given ID. |
| [DeleteFromAllSubstacks](#deletefromallsubstacks) | `void` | Removes the pair from every layer stack it belongs to. |
| [DeleteFromSubstack](#deletefromsubstack) | `void` | Removes the pair from the layer stack with the given ID. |
| [IsDefinedIn](#isdefinedin) | `bool` | Returns whether the pair belongs to the layer stack with the given ID. |
| [IsSimilarTo](#issimilarto) | `bool` | Returns whether this pair has the same type and the same two layers as another pair. |
| [OrderLayers](#orderlayers) | `void` | Swaps [`LowLayer`](#lowlayer) and [`HighLayer`](#highlayer) when [`LowLayer`](#lowlayer) is below [`HighLayer`](#highlayer) in the layer stack, so that [`LowLayer`](#lowlayer) is the upper layer. |

### AddToSubstack

Adds the pair to the layer stack with the given ID.

```csharp
void AddToSubstack(string argStackID);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argStackID` | `string` | value | The ID of the layer stack, as returned by [`IPCB_LayerStackBase.ID`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerStackBase.md#id). |

**Returns:** nothing (`void`)

Afterwards [`IsDefinedIn`](#isdefinedin) returns true for that ID. Adding the pair to a stack it already belongs to has no further effect.

### DeleteFromAllSubstacks

Removes the pair from every layer stack it belongs to.

```csharp
void DeleteFromAllSubstacks();
```

**Returns:** nothing (`void`)

Afterwards [`IsDefinedIn`](#isdefinedin) returns false for every stack ID.

### DeleteFromSubstack

Removes the pair from the layer stack with the given ID.

```csharp
void DeleteFromSubstack(string argStackID);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argStackID` | `string` | value | The ID of the layer stack, as returned by [`IPCB_LayerStackBase.ID`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerStackBase.md#id). |

**Returns:** nothing (`void`)

Does nothing when the pair does not belong to that stack.

### IsDefinedIn

Returns whether the pair belongs to the layer stack with the given ID.

```csharp
bool IsDefinedIn(string argStackID);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argStackID` | `string` | value | The ID of the layer stack, as returned by [`IPCB_LayerStackBase.ID`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerStackBase.md#id). |

**Returns:** `bool`

### IsSimilarTo

Returns whether this pair has the same type and the same two layers as another pair.

```csharp
bool IsSimilarTo(IPCB_DrillLayerPair argDLP);
bool IsSimilarTo(object argDLP);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argDLP` | [IPCB_DrillLayerPair](#) | value | The pair to compare with. |

**Returns:** `bool`

The first overload is an extension method of `IPCB_DrillLayerPairHelper` (`using PCB;`) with typed parameters; the second is declared by the interface.

The layers are compared in either order, so a pair from layer A to layer B is similar to a pair from layer B to layer A of the same type. A counter-hole pair is similar only to another counter-hole pair that is drilled in the same direction.

### OrderLayers

Swaps [`LowLayer`](#lowlayer) and [`HighLayer`](#highlayer) when [`LowLayer`](#lowlayer) is below [`HighLayer`](#highlayer) in the layer stack, so that [`LowLayer`](#lowlayer) is the upper layer.

```csharp
void OrderLayers();
```

**Returns:** nothing (`void`)

## Returned by

[IPCB_Board.LayerPair](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#layerpair), [IPCB_Board.LayerPairByPair](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#layerpairbypair), [IPCB_Board.LayerPairByPairEx](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#layerpairbypairex), [IPCB_DrillTable.LayerPair](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_DrillTable.md#layerpair)
