Home > PCB_Drc > getAllDifferentialPairs
PCB_Drc.getAllDifferentialPairs() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取所有差分对的详细属性
签名
typescript
function getAllDifferentialPairs(): Promise<Array<IPCB_DifferentialPairItem> | Record<string, any>>;1
返回值
Promise<Array<IPCB_DifferentialPairItem> | Record<string, any>>
所有差分对的详细属性
备注
BREAKING CHANGE since EDA v3.4
- 返回值类型更改为对象
示例
javascript
// 1. 生成本次运行专用的网络名和差分对名,创建测试差分对
const ts = Date.now();
const netP = `JLC_DEMO_DP_P_${ts}`;
const netN = `JLC_DEMO_DP_N_${ts}`;
const x = 3000 + Math.floor(Math.random() * 20000);
await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], netP, null, 0, 0, 0, false, 0);
await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], netN, null, 0, 0, 0, false, 0);
const pairName = `嘉立创示例_查询差分对_${ts}`;
await eda.pcb_Drc.createDifferentialPair(pairName, netP, netN);
// 2. 查询所有差分对(v3.4 起返回结构可能为数组或对象,先按数组遍历)
const pairs = await eda.pcb_Drc.getAllDifferentialPairs();
const list = Array.isArray(pairs) ? pairs : Object.values(pairs);
console.log('count:', list.length);
list.forEach((p, i) => {
console.log(`[${i}] name:`, p.name, 'positiveNet:', p.positiveNet, 'negativeNet:', p.negativeNet);
});
// 3. 清理测试差分对(查询类清理现场)
await eda.pcb_Drc.deleteDifferentialPair(pairName);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