
# IPCB_GroupIterator interface

An iterator that fetches the child objects of a group object, such as the pads and tracks of a component.

```csharp
public interface IPCB_GroupIterator : IPCB_AbstractIterator
```

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

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

## Remarks

Group objects include components, footprints in a PCB library ([`IPCB_LibComponent`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_LibComponent.md)), polygons, split planes, nets, dimensions, coordinates and the board outline. Create the iterator with [`IPCB_Group.GroupIterator_Create`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Group.md#groupiterator_create) on the group object and destroy it with [`IPCB_Group.GroupIterator_Destroy`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Group.md#groupiterator_destroy) on the same object. The filters and the walk are inherited from [`IPCB_AbstractIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md); a new group iterator fetches the children of every kind on every layer.

To fetch the child objects of the components of a board, fetch the components with an [`IPCB_BoardIterator`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_BoardIterator.md), create a group iterator for each component, and destroy it when its child objects are done. Destroy the board iterator when the walk over the board is finished.

## Example

Count the top overlay tracks of the first components on the current board.

```csharp
using PCB;

int trackCount = 0;
int componentCount = 0;
IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
    return;

// Create a board iterator to fetch the components.
IPCB_BoardIterator componentIterator = board.BoardIterator_Create();
componentIterator.AddFilter_ObjectSet(new PCB.TObjectSet { TObjectId.eComponentObject });
componentIterator.AddFilter_AllLayers();
componentIterator.AddFilter_Method(TIterationMethod.eProcessAll);

var component = componentIterator.FirstPCBObject() as IPCB_Component;
while (component != null)
{
    // Create an iterator from the component to fetch its child tracks.
    IPCB_GroupIterator trackIterator = component.GroupIterator_Create();
    trackIterator.AddFilter_ObjectSet(new PCB.TObjectSet { TObjectId.eTrackObject });
    trackIterator.AddFilter_LayerSet(new TV6_LayerSet { TV6_Layer.eV6_TopOverlay });
    for (IPCB_Primitive track = trackIterator.FirstPCBObject(); track != null; track = trackIterator.NextPCBObject())
        trackCount++;

    DXP.Utils.ShowInfo("This component " + component.GetState_SourceDesignator() + " has " + trackCount + " tracks.", "Tracks");
    trackCount = 0;

    // When finished iterating the component's child objects, destroy its group iterator.
    component.GroupIterator_Destroy(ref trackIterator);
    component = componentIterator.NextPCBObject() as IPCB_Component;
    componentCount++;
    if (componentCount > 5)
        break;
}

// When finished iterating the board, destroy the board iterator.
board.BoardIterator_Destroy(ref componentIterator);
```

This interface declares no members of its own.

## Inherited members

- From [IPCB_AbstractIterator](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md): [AddFilter_AllLayers](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_alllayers), [AddFilter_Area](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_area), [AddFilter_IPCB_LayerSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_ipcb_layerset), [AddFilter_LayerSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_layerset), [AddFilter_LayerSet_1](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_layerset_1), [AddFilter_LayerSet_2](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_layerset_2), [AddFilter_ObjectSet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#addfilter_objectset), [FirstPCBObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#firstpcbobject), [NextPCBObject](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#nextpcbobject), [SetState_FilterAll](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_AbstractIterator.md#setstate_filterall)

## Returned by

[IPCB_Group.GroupIterator_Create](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Group.md#groupiterator_create)

## Accepted by

[IPCB_Group.GroupIterator_Destroy](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Group.md#groupiterator_destroy)
