Home > PCB_Net > getNetLength
PCB_Net.getNetLength() method
获取指定网络的长度
签名
typescript
function getNetLength(net: string): Promise<number | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
net | string | 网络名称 |
返回值
Promise<number | undefined>
网络长度,undefined 为不存在该网络,0 为网络无长度
示例
javascript
// 1. 创建带网络名的过孔和导线(导线长 1000mil,让网络有实际长度)
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
const line = await eda.pcb_PrimitiveLine.create('嘉立创示例_NET1', 1, 2000, 2000, 3000, 2000, 10);
// 2. 获取该网络的布线总长
const netLength = await eda.pcb_Net.getNetLength('嘉立创示例_NET1');
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
await eda.pcb_PrimitiveLine.delete([line.getState_PrimitiveId()]);
console.log('netLength:', netLength);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12