Home > IPCB_PrimitiveComponent > getAllPins
IPCB_PrimitiveComponent.getAllPins() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get all pads associated with the device
Signature
typescript
function getAllPins(): Promise<Array<IPCB_PrimitiveComponentPad>>;1
Returns
Promise<Array<IPCB_PrimitiveComponentPad>>
Device pad primitive array
Example
javascript
// 1. 放置一个测试器件
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
// 2. 获取器件关联的所有焊盘图元
const pins = await comp.getAllPins();
// 3. 逐个读取焊盘的归属器件和图元 ID
const pinInfos = pins.map(pin => ({
parentMatch: pin.getState_ParentComponentPrimitiveId() === compId,
primitiveId: pin.getState_PrimitiveId(),
}));
// 4. 清理测试器件
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);
console.log('allBelongToComponent:', pinInfos.every(p => p.parentMatch));
console.log('firstPinPrimitiveId:', pinInfos[0].primitiveId);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20