IPCB_SpatialIterator interface
An iterator that fetches the design objects of a PCB document in a rectangular area.
public interface IPCB_SpatialIterator : IPCB_AbstractIterator
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Inherits: IPCB_AbstractIterator
Derived: IPCB_SpatialIterator2
Remarks
Create it with IPCB_Board.SpatialIterator_Create and destroy it with IPCB_Board.SpatialIterator_Destroy. Set the object kinds, the layers and the area with the AddFilter_ObjectSet, AddFilter_LayerSet and AddFilter_Area methods inherited from IPCB_AbstractIterator; without AddFilter_Area the iterator searches the whole board.
A spatial iterator skips group objects: components, polygons, split planes, nets, dimensions and coordinates are not fetched, even when the object filter includes them. Use an IPCB_BoardIterator to fetch them.
Example
Select the tracks and arcs on the top and bottom layers within an area.
using PCB;
IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
return;
// Sample values: the area to search.
int x1 = EDP.Utils.MilsToCoord(1000);
int y1 = EDP.Utils.MilsToCoord(1000);
int x2 = EDP.Utils.MilsToCoord(3000);
int y2 = EDP.Utils.MilsToCoord(3000);
// Top/bottom layers and arc/track objects define
// the spatial iterator constraints.
var aSetOfLayers = new TV6_LayerSet { TV6_Layer.eV6_TopLayer, TV6_Layer.eV6_BottomLayer };
var aSetOfObjects = new PCB.TObjectSet { TObjectId.eArcObject, TObjectId.eTrackObject };
IPCB_SpatialIterator iterator = board.SpatialIterator_Create();
iterator.AddFilter_ObjectSet(aSetOfObjects);
iterator.AddFilter_LayerSet(aSetOfLayers);
iterator.AddFilter_Area(x1, y1, x2, y2);
// Iterate over tracks and arcs on the top and bottom layers.
IPCB_Primitive pcbObject = iterator.FirstPCBObject();
while (pcbObject != null)
{
pcbObject.SetState_Selected(true);
pcbObject = iterator.NextPCBObject();
}
board.SpatialIterator_Destroy(ref iterator);
Methods
| Method | Returns | Description |
|---|---|---|
| AddFilter_ProcessSpecialLayers | void | Also fetches the shapes that objects produce on the mechanical layers used as solder mask or paste mask layers of a layer stack. |
AddFilter_ProcessSpecialLayers
Also fetches the shapes that objects produce on the mechanical layers used as solder mask or paste mask layers of a layer stack.
void AddFilter_ProcessSpecialLayers();
Returns: nothing (void)
The shapes are fetched after all other objects. They are new objects on the mechanical layer, created by the iterator from the objects of the requested kinds on the top or bottom layer of the layer stack and on the multi-layer; they are not objects of the board, and they are freed when the iterator is destroyed. No shapes are fetched when the object filter includes none of arcs, pads, vias, regions and fills, or when the layer filter does not include the mechanical layer.
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.SpatialIterator_Create