Home > PCB_Net > getNetLength
PCB_Net.getNetLength() method
Get the length of the specified net
Signature
typescript
function getNetLength(net: string): Promise<number | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
net | string | Net name |
Returns
Promise<number | undefined>
Net length. undefined means the net does not exist; 0 means the net has no length
Example
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