IPCB_BoardIterator interface
An iterator that fetches the design objects of a PCB document.
public interface IPCB_BoardIterator : IPCB_AbstractIterator
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Inherits: IPCB_AbstractIterator
Remarks
With the iterator, you can control which objects on which layers are fetched with the AddFilter_ObjectSet and AddFilter_LayerSet methods, and with AddFilter_Method whether objects that belong to a component or another group object are included. AddFilter_Area does not restrict a board iterator: use an IPCB_SpatialIterator to fetch the objects in an area.
Example
Count the pads on the current board.
using PCB;
IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
return;
// Set up a board iterator for pads on all layers.
IPCB_BoardIterator iterator = board.BoardIterator_Create();
iterator.AddFilter_ObjectSet(new PCB.TObjectSet { TObjectId.ePadObject });
iterator.AddFilter_AllLayers();
iterator.AddFilter_Method(TIterationMethod.eProcessAll);
// Search for and count the pads.
int padNumber = 0;
for (IPCB_Primitive pad = iterator.FirstPCBObject(); pad != null; pad = iterator.NextPCBObject())
padNumber++;
board.BoardIterator_Destroy(ref iterator);
DXP.Utils.ShowInfo("Pad Count = " + padNumber, "Pads");
Methods
| Method | Returns | Description |
|---|---|---|
| AddFilter_Method | void | Selects the objects to fetch by whether they belong to a group object, such as a component. |
AddFilter_Method
Selects the objects to fetch by whether they belong to a group object, such as a component.
void AddFilter_Method(TIterationMethod argMethod);
void AddFilter_Method(int argMethod);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argMethod | TIterationMethod | value | TIterationMethod.eProcessAll fetches all objects. TIterationMethod.eProcessFree fetches only free objects: objects that are not part of a component, polygon, coordinate or dimension, and group objects such as components themselves. TIterationMethod.eProcessComponent fetches only the objects that are not free. |
Returns: nothing (void)
The first overload is an extension method of IPCB_BoardIteratorHelper (using PCB;) with typed parameters; the second is declared by the interface.
A new iterator fetches all objects (TIterationMethod.eProcessAll). The setting applies to the objects fetched by the following FirstPCBObject and NextPCBObject calls.
Examples: Extension_BOMManager, Extension_Pad_SolderMask
Inherited members
- From IPCB_AbstractIterator: AddFilter_AllLayers, AddFilter_Area, AddFilter_IPCB_LayerSet, AddFilter_LayerSet, AddFilter_LayerSet_1, AddFilter_LayerSet_2, AddFilter_ObjectSet, FirstPCBObject, NextPCBObject, SetState_FilterAll
Returned by
IPCB_Board.BoardIterator_Create
Accepted by
IPCB_Board.BoardIterator_Destroy
Examples
Used in the SDK examples: Extension_PCBUndoRedo, Extension_Pad_SolderMask.