Home > SCH_PrimitiveComponent > getAllPinsByPrimitiveId
SCH_PrimitiveComponent.getAllPinsByPrimitiveId() 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 pins associated with the device
Signature
typescript
function getAllPinsByPrimitiveId(
primitiveId: string,
): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;1
2
3
2
3
Parameters
Parameter | Type | Description |
|---|---|---|
primitiveId | string | Device primitive ID |
Returns
Promise<Array<ISCH_PrimitiveComponentPin> | undefined>
Device pin primitive array
Example
javascript
// 1. 创建一个带引脚的测试器件(随机坐标避免重合,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('');
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
const comp = await eda.sch_PrimitiveComponent.create(devices[0], x, y);
const compId = comp.getState_PrimitiveId();
// 2. 按图元 ID 取出该器件的全部引脚(返回纯数据对象,字段直接可读)
const pins = await eda.sch_PrimitiveComponent.getAllPinsByPrimitiveId(compId);
// 3. 清理测试图元(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('pin count:', pins.length);
console.log('first pin number:', pins[0].pinNumber);
console.log('first pin type:', pins[0].pinType);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16