Home > ISCH_PrimitiveComponent > getAllPins
ISCH_PrimitiveComponent.getAllPins() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取器件关联的所有引脚
签名
typescript
function getAllPins(): Promise<Array<ISCH_PrimitiveComponentPin> | undefined>;1
返回值
Promise<Array<ISCH_PrimitiveComponentPin> | undefined>
器件引脚图元数组
示例
javascript
// 1. 放置一个测试器件(C0402 电容有两个引脚,SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 获取器件全部引脚(C0402 电容返回 2 个引脚图元)
const pins = await comp.getAllPins();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('pinCount:', pins.length);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12