
# IPCB_AbstractIterator interface

The base interface of the PCB object iterators, with the filters that select the objects to fetch and the methods that step through them.

```csharp
public interface IPCB_AbstractIterator
```

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

**Derived:** [IPCB_BoardIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_BoardIterator.md), [IPCB_GroupIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_GroupIterator.md), [IPCB_LibraryIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LibraryIterator.md), [IPCB_SpatialIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_SpatialIterator.md)

## Remarks

[`IPCB_BoardIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_BoardIterator.md), [`IPCB_SpatialIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_SpatialIterator.md), [`IPCB_GroupIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_GroupIterator.md) and [`IPCB_LibraryIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LibraryIterator.md) derive from it. Set the filters, then call [`FirstPCBObject`](#firstpcbobject) and [`NextPCBObject`](#nextpcbobject) until they return `null`.

An object is fetched only when it passes every filter: the object kinds, the layers and, for a spatial iterator, the area. Each [`AddFilter_ObjectSet`](#addfilter_objectset) or [`AddFilter_LayerSet`](#addfilter_layerset) call replaces the previous filter of the same kind; it does not narrow it.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [AddFilter_AllLayers](#addfilter_alllayers) | `void` | Removes the layer filter, so that objects on all layers are fetched. |
| [AddFilter_Area](#addfilter_area) | `void` | Restricts a spatial iterator to the objects in a rectangular area. |
| [AddFilter_IPCB_LayerSet](#addfilter_ipcb_layerset) | `void` | Restricts the iterator to the objects on the layers of an [`IPCB_LayerSet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md), as [`AddFilter_LayerSet_1`](#addfilter_layerset_1) does. |
| [AddFilter_LayerSet](#addfilter_layerset) | `void` | Restricts the iterator to the objects on the layers of a layer set. |
| [AddFilter_LayerSet_1](#addfilter_layerset_1) | `void` | Restricts the iterator to the objects on the layers of an [`IPCB_LayerSet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md). |
| [AddFilter_LayerSet_2](#addfilter_layerset_2) | `void` |  |
| [AddFilter_ObjectSet](#addfilter_objectset) | `void` | Restricts the iterator to objects of the given kinds. |
| [FirstPCBObject](#firstpcbobject) | [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md) | Starts the walk and returns the first object that passes the filters, or `null` when there is none. |
| [NextPCBObject](#nextpcbobject) | [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md) | Returns the next object that passes the filters, or `null` when there are no more objects. |
| [SetState_FilterAll](#setstate_filterall) | `void` | Removes the object kind filter, so that objects of every kind are fetched again. |

### AddFilter_AllLayers

Removes the layer filter, so that objects on all layers are fetched.

```csharp
void AddFilter_AllLayers();
```

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

A new group iterator has no layer filter. A new board or spatial iterator fetches objects on all layers except a few system layers, such as `TV6_Layer.eV6_PadHoleLayer` and `TV6_Layer.eV6_ViaHoleLayer`.

### AddFilter_Area

Restricts a spatial iterator to the objects in a rectangular area.

```csharp
void AddFilter_Area(int argx1, int argy1, int argx2, int argy2);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argx1` | `int` | value | X coordinate of one corner of the area, in internal units (10,000 per mil). |
| `argy1` | `int` | value | Y coordinate of the same corner, in internal units (10,000 per mil). |
| `argx2` | `int` | value | X coordinate of the opposite corner, in internal units (10,000 per mil). |
| `argy2` | `int` | value | Y coordinate of the opposite corner, in internal units (10,000 per mil). |

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

The corners can be given in any order. A board iterator ignores the area: use an [`IPCB_SpatialIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_SpatialIterator.md) to fetch the objects in an area. Without this filter, a spatial iterator searches the whole board.

### AddFilter_IPCB_LayerSet

Restricts the iterator to the objects on the layers of an [`IPCB_LayerSet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md), as [`AddFilter_LayerSet_1`](#addfilter_layerset_1) does.

```csharp
void AddFilter_IPCB_LayerSet(IPCB_LayerSet argLayerSet);
void AddFilter_IPCB_LayerSet(object argLayerSet);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argLayerSet` | [IPCB_LayerSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md) | value | The layers to fetch objects on. |

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

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

### AddFilter_LayerSet

Restricts the iterator to the objects on the layers of a layer set.

```csharp
void AddFilter_LayerSet(TV6_LayerSet argLayerSet);
void AddFilter_LayerSet(ITransportSet argLayerSet);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argLayerSet` | [TV6_LayerSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TV6_LayerSet.md) | value | The layers to fetch objects on. |

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

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

On a board or group iterator, connections are fetched only when the set includes `TV6_Layer.eV6_ConnectLayer`. Objects that do not belong to a layer (vias, nets, classes, rules, violations, differential pairs, from-tos, embedded objects and the board object) are fetched only when the set includes `TV6_Layer.eV6_MultiLayer`. Other objects are fetched when the set includes their own layer, so a pad on the multi-layer also needs `TV6_Layer.eV6_MultiLayer`.

**Examples:** [Extension_PCBUndoRedo](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PCBUndoRedo/Source%20Code/Commands.cs#L42)

### AddFilter_LayerSet_1

Restricts the iterator to the objects on the layers of an [`IPCB_LayerSet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md).

```csharp
void AddFilter_LayerSet_1(IPCB_LayerSet argLayerSet);
void AddFilter_LayerSet_1(object argLayerSet);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argLayerSet` | [IPCB_LayerSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LayerSet.md) | value | The layers to fetch objects on. |

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

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

The layers are matched as described for [`AddFilter_LayerSet`](#addfilter_layerset).

### AddFilter_LayerSet_2

*No description yet.*

```csharp
void AddFilter_LayerSet_2(TLayerPartitionSet argLayerSet);
void AddFilter_LayerSet_2(ITransportSet argLayerSet);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argLayerSet` | [TLayerPartitionSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TLayerPartitionSet.md) | value |

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

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

**Examples:** [Extension_BOMManager](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_BOMManager/Source%20Code/PcbBom.cs#L40), [Extension_Pad_SolderMask](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Pad_SolderMask/Source%20Code/Commands.cs#L36)

### AddFilter_ObjectSet

Restricts the iterator to objects of the given kinds.

```csharp
void AddFilter_ObjectSet(TObjectSet argObjectSet);
void AddFilter_ObjectSet(ITransportSet argObjectSet);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argObjectSet` | [TObjectSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/TObjectSet.md) | value | The kinds of objects to fetch. |

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

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

A new iterator has no object filter. By default, a spatial iterator skips group objects such as components, even when the set includes them (see [`IPCB_SpatialIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_SpatialIterator.md)).

**Examples:** [Extension_BOMManager](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_BOMManager/Source%20Code/PcbBom.cs#L39), [Extension_PCBUndoRedo](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PCBUndoRedo/Source%20Code/Commands.cs#L41), [Extension_Pad_SolderMask](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Pad_SolderMask/Source%20Code/Commands.cs#L35)

### FirstPCBObject

Starts the walk and returns the first object that passes the filters, or `null` when there is none.

```csharp
IPCB_Primitive FirstPCBObject();
```

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

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

**Examples:** [Extension_BOMManager](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_BOMManager/Source%20Code/PcbBom.cs#L43), [Extension_PCBUndoRedo](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PCBUndoRedo/Source%20Code/Commands.cs#L44), [Extension_Pad_SolderMask](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Pad_SolderMask/Source%20Code/Commands.cs#L40), [Extension_PcbLibComponentToSTEP](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PcbLibComponentToSTEP/Source%20Code/Commands.cs#L40), [Extension_PcbLibToImage](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PcbLibToImage/Source%20Code/Commands.cs#L49)

### NextPCBObject

Returns the next object that passes the filters, or `null` when there are no more objects.

```csharp
IPCB_Primitive NextPCBObject();
```

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

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

Start the walk with [`FirstPCBObject`](#firstpcbobject); `NextPCBObject` continues after the object returned last.

**Examples:** [Extension_BOMManager](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_BOMManager/Source%20Code/PcbBom.cs#L49), [Extension_PCBUndoRedo](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PCBUndoRedo/Source%20Code/Commands.cs#L51), [Extension_Pad_SolderMask](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_Pad_SolderMask/Source%20Code/Commands.cs#L50), [Extension_PcbLibComponentToSTEP](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PcbLibComponentToSTEP/Source%20Code/Commands.cs#L55), [Extension_PcbLibToImage](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_PcbLibToImage/Source%20Code/Commands.cs#L62)

### SetState_FilterAll

Removes the object kind filter, so that objects of every kind are fetched again.

```csharp
void SetState_FilterAll();
```

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

The other filters depend on the iterator. A board iterator gets the layer filter of a new board iterator back and keeps the setting of [`IPCB_BoardIterator.AddFilter_Method`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_BoardIterator.md#addfilter_method). A group iterator loses its layer filter. A spatial iterator loses its area filter and keeps its layer filter.

## Accepted by

[IPCB_EmbeddedBoard.ApplyFilterToIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_EmbeddedBoard.md#applyfiltertoiterator)
