Skip to main content
View as Markdown

IPCB_GroupIterator interface

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

public interface IPCB_GroupIterator : IPCB_AbstractIterator

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Inherits: IPCB_AbstractIterator

Remarks​

Group objects include components, footprints in a PCB library (IPCB_LibComponent), polygons, split planes, nets, dimensions, coordinates and the board outline. Create the iterator with IPCB_Group.GroupIterator_Create on the group object and destroy it with IPCB_Group.GroupIterator_Destroy on the same object. The filters and the walk are inherited from IPCB_AbstractIterator; 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, 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.

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​

Returned by​

IPCB_Group.GroupIterator_Create

Accepted by​

IPCB_Group.GroupIterator_Destroy