
# IPCB_ViaTemplate interface

A via template, a reusable set of via properties (hole size, solder mask settings, per-layer diameters and thermal reliefs, and the via structure) that vias can be linked to.

```csharp
public interface IPCB_ViaTemplate : IPCB_PadViaTemplate
```

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

**Inherits:** [IPCB_PadViaTemplate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md)

## Remarks

The template's name, identifiers and library are members of [`IPCB_PadViaTemplate`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md). [`IPCB_Board.FindLinkedBoardTemplate`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#findlinkedboardtemplate) returns the template a via is linked to, as an [`IPCB_PadViaTemplate`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md).

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [HoleSize](#holesize) | `int` | get; set | The size of the via's hole, in internal units (10,000 per mil). |
| [IsTenting_Bottom](#istenting_bottom) | `bool` | get; set | Whether the via is tented (covered by solder mask) on the bottom side. |
| [IsTenting_Top](#istenting_top) | `bool` | get; set | Whether the via is tented (covered by solder mask) on the top side. |
| [ManualSolderMask](#manualsoldermask) | `bool` | get; set | Whether the template sets the via's solder mask expansion itself instead of taking it from the design rules. |
| [Mode](#mode) | [TPadMode](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TPadMode.md) | get; set | How the via's diameter is defined on its layers. |
| [SolderMaskBottomExpansion](#soldermaskbottomexpansion) | `int` | get; set | The solder mask expansion of the via on the bottom side, in internal units (10,000 per mil). |
| [SolderMaskExpansion](#soldermaskexpansion) | `int` | get; set | The solder mask expansion of the via, in internal units (10,000 per mil). |
| [SolderMaskHoleEdge](#soldermaskholeedge) | `bool` | get; set | Whether the via's solder mask expansion is measured from the edge of the hole instead of the edge of the copper. |
| [StackData](#stackdata) | [IPCB_ViaTemplateStackData](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md) | get; set | An entry of the template's via stack, which describes the via's diameter and thermal relief on one layer. |
| [UseSeparateExpansions](#useseparateexpansions) | `bool` | get; set | Whether the via has separate solder mask expansions for the top side ([`SolderMaskExpansion`](#soldermaskexpansion)) and the bottom side ([`SolderMaskBottomExpansion`](#soldermaskbottomexpansion)). |
| [ViaStructure](#viastructure) | [IPCB_ViaStructure](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaStructure.md) | get | The via structure (the via's protection features, such as tenting, plugging or filling) that the template gives its vias. |

### HoleSize

The size of the via's hole, in internal units (10,000 per mil).

```csharp
int GetState_HoleSize();
void SetState_HoleSize(int argValue);
```

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

### IsTenting_Bottom

Whether the via is tented (covered by solder mask) on the bottom side.

```csharp
bool GetState_IsTenting_Bottom();
void SetState_IsTenting_Bottom(bool argValue);
```

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

When the template is applied to a via, the setting takes effect only for a via that starts or ends on the bottom layer.

### IsTenting_Top

Whether the via is tented (covered by solder mask) on the top side.

```csharp
bool GetState_IsTenting_Top();
void SetState_IsTenting_Top(bool argValue);
```

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

When the template is applied to a via, the setting takes effect only for a via that starts or ends on the top layer.

### ManualSolderMask

Whether the template sets the via's solder mask expansion itself instead of taking it from the design rules.

```csharp
bool GetState_ManualSolderMask();
void SetState_ManualSolderMask(bool argValue);
```

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

When the value is false, [`SolderMaskExpansion`](#soldermaskexpansion), [`SolderMaskBottomExpansion`](#soldermaskbottomexpansion) and [`UseSeparateExpansions`](#useseparateexpansions) are not applied to vias, and the applicable design rule decides the solder mask expansion.

### Mode

How the via's diameter is defined on its layers.

```csharp
TPadMode GetState_Mode();
void SetState_Mode(TPadMode argValue);
```

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

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

Assigning a different mode replaces the entries of [`StackData`](#stackdata) with default entries: one for the top layer for `TPadMode.ePadMode_Simple`, and one each for the top layer, the mid layers and the bottom layer for `TPadMode.ePadMode_LocalStack` and `TPadMode.ePadMode_ExternalStack`. Assigning the current mode changes nothing.

**See also:** [TPadMode](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TPadMode.md)

### SolderMaskBottomExpansion

The solder mask expansion of the via on the bottom side, in internal units (10,000 per mil).

```csharp
int GetState_SolderMaskBottomExpansion();
void SetState_SolderMaskBottomExpansion(int argValue);
```

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

Applies only when [`ManualSolderMask`](#manualsoldermask) is true.

### SolderMaskExpansion

The solder mask expansion of the via, in internal units (10,000 per mil).

```csharp
int GetState_SolderMaskExpansion();
void SetState_SolderMaskExpansion(int argValue);
```

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

Applies only when [`ManualSolderMask`](#manualsoldermask) is true.

### SolderMaskHoleEdge

Whether the via's solder mask expansion is measured from the edge of the hole instead of the edge of the copper.

```csharp
bool GetState_SolderMaskHoleEdge();
void SetState_SolderMaskHoleEdge(bool argValue);
```

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

### StackData

An entry of the template's via stack, which describes the via's diameter and thermal relief on one layer.

```csharp
IPCB_ViaTemplateStackData GetState_StackData(int argIndex);
void SetState_StackData(int argIndex, IPCB_ViaTemplateStackData argValue);
```

**Type:** [IPCB_ViaTemplateStackData](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md) · **Access:** read/write · **Index:** `argIndex` (`int`): The zero-based index of the entry, from 0 to [`StackDataCount`](#stackdatacount) - 1.

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

Reading an entry returns a copy: changes to the returned object take effect only when it is assigned back. Assigning null changes nothing.

When the template is applied to a via, the entry for each layer is found by its [`IPCB_ViaTemplateStackData.Layer`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md#layer); a layer without an entry gets default values (in `TPadMode.ePadMode_ExternalStack`, a mid layer without an entry gets the values of the entry for the mid layers). An entry's [`IPCB_ViaTemplateStackData.ThermalRelief`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md#thermalrelief) is applied only when its [`PadViaThermalReliefData.DefinedType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/PadViaThermalReliefData.md#definedtype) is `TThermalReliefDefinedType.trdUser`.

### UseSeparateExpansions

Whether the via has separate solder mask expansions for the top side ([`SolderMaskExpansion`](#soldermaskexpansion)) and the bottom side ([`SolderMaskBottomExpansion`](#soldermaskbottomexpansion)).

```csharp
bool GetState_UseSeparateExpansions();
void SetState_UseSeparateExpansions(bool argValue);
```

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

Applies only when [`ManualSolderMask`](#manualsoldermask) is true.

### ViaStructure

The via structure (the via's protection features, such as tenting, plugging or filling) that the template gives its vias.

```csharp
IPCB_ViaStructure GetState_ViaStructure();
```

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

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

The returned object is the template's own via structure: changes to it change the template. When the template is applied to a via, the via gets a copy of it; when its [`IPCB_ViaStructure.StructureType`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaStructure.md#structuretype) is `TViaStructureType.eViaStructureType_None`, the via gets no via structure.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [AddStackData](#addstackdata) | `int` | Adds a per-layer entry to the template's via stack and returns its index. |
| [ClearStackData](#clearstackdata) | `void` | Removes all entries from the template's via stack. |
| [CreateDefaultStackData](#createdefaultstackdata) | [IPCB_ViaTemplateStackData](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md) | Creates a new via stack entry with default values. |
| [StackDataCount](#stackdatacount) | `int` | Returns the number of entries in the template's via stack. |

### AddStackData

Adds a per-layer entry to the template's via stack and returns its index.

```csharp
int AddStackData(IPCB_ViaTemplateStackData argValue);
int AddStackData(object argValue);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argValue` | [IPCB_ViaTemplateStackData](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md) | value | The entry to add. The template stores a copy of it. |

**Returns:** `int`

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

Returns -1 and adds nothing when the value is null.

### ClearStackData

Removes all entries from the template's via stack.

```csharp
void ClearStackData();
```

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

### CreateDefaultStackData

Creates a new via stack entry with default values.

```csharp
IPCB_ViaTemplateStackData CreateDefaultStackData();
```

**Returns:** [IPCB_ViaTemplateStackData](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_ViaTemplateStackData.md)

Extension method of `IPCB_ViaTemplateHelper` (`using PCB;`).

The entry is not added to the template; pass it to [`AddStackData`](#addstackdata) or assign it to [`StackData`](#stackdata). It has no layer, a diameter of 50 mil and a thermal relief taken from the design rules (`TThermalReliefDefinedType.trdRule`).

### StackDataCount

Returns the number of entries in the template's via stack.

```csharp
int StackDataCount();
```

**Returns:** `int`

## Inherited members

- From [IPCB_PadViaTemplate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md): [CreateTemplateLink](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#createtemplatelink), [ExternalLink](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#externallink), [GetFullTemplateID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#getfulltemplateid), [HasLocalChanges](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#haslocalchanges), [Internal](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#internal), [LibraryID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#libraryid), [ObjectID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#objectid), [PrimLinkCount](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#primlinkcount), [RemoveUnused](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#removeunused), [RevisionID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#revisionid), [TemplateDescription](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#templatedescription), [TemplateID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#templateid), [TemplateName](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_PadViaTemplate.md#templatename)
