Home > PCB_Net > getNetColor
PCB_Net.getNetColor() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取指定网络的颜色
签名
typescript
function getNetColor(net: string): Promise<IPCB_NetInfo['color'] | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
net | string | 网络名称 |
返回值
Promise<IPCB_NetInfo['color'] | undefined>
网络颜色,undefined 为不存在该网络
示例
javascript
// 1. 创建带网络名的过孔,让 PCB 中出现可查询的网络
const via = await eda.pcb_PrimitiveVia.create('嘉立创示例_NET1', 2000, 2000, 20, 40);
// 2. 读取该网络当前的颜色
const color = await eda.pcb_Net.getNetColor('嘉立创示例_NET1');
// 3. 清理测试图元(查询类需要清理)
await eda.pcb_PrimitiveVia.delete([via.getState_PrimitiveId()]);
console.log('netColor:', color);1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10