Home > PCB_Drc > createNetClass
PCB_Drc.createNetClass() 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.
Create Net class
Signature
typescript
function createNetClass(
netClassName: string,
nets: Array<string>,
color: IPCB_EqualLengthNetGroupItem['color'],
): Promise<boolean>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
netClassName | string | Net class name |
nets | Array<string> | Net name array |
color | IPCB_EqualLengthNetGroupItem['color'] | Net class color |
Returns
Promise<boolean>
Whether the operation is successful
Example
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