Home > PCB_Net > getAllNets
PCB_Net.getAllNets() 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 Detailed information of the net
Signature
typescript
function getAllNets(): Promise<Array<IPCB_NetInfo>>;1
Returns
Promise<Array<IPCB_NetInfo>>
Detailed information of all nets
Example
javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 一次性取回当前 PCB 的全部网络详情
const nets = await eda.pcb_Net.getAllNets();
// 3. 查看示例网络的典型属性
const target = nets.find(n => n.net === '嘉立创示例_NET1');
// 4. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('totalNetCount:', nets.length);
console.log('targetNetName:', target?.net);
console.log('targetNetColor:', target?.color);
console.log('targetNetLength:', target?.length);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