Home > PCB_Drc > createNetClass
PCB_Drc.createNetClass() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建网络类
签名
typescript
function createNetClass(
netClassName: string,
nets: Array<string>,
color: IPCB_EqualLengthNetGroupItem['color'],
): Promise<boolean>;1
2
3
4
5
2
3
4
5
参数名
参数 | 类型 | 描述 |
|---|---|---|
netClassName | string | 网络类名称 |
nets | Array<string> | 网络名称数组 |
color | IPCB_EqualLengthNetGroupItem['color'] | 网络类颜色 |
返回值
Promise<boolean>
操作是否成功
示例
javascript
// 1. 放两个带网络的测试焊盘,让 JLC_DEMO_P / JLC_DEMO_N 进入网表
const x = 3000 + Math.floor(Math.random() * 20000);
const padP = await eda.pcb_PrimitivePad.create(1, '1', x, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_P', null, 0, 0, 0, false, 0);
const padN = await eda.pcb_PrimitivePad.create(1, '2', x + 500, 3000, 0, ['ELLIPSE', 60, 60], 'JLC_DEMO_N', null, 0, 0, 0, false, 0);
// 2. 创建网络类并纳入这两个网络,颜色用于面板区分(保留现场供观察)
const created = await eda.pcb_Drc.createNetClass('嘉立创示例_网络类', ['JLC_DEMO_P', 'JLC_DEMO_N'], { r: 255, g: 0, b: 0, alpha: 1 });
console.log('created:', created);1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9