Home > SCH_Netlist > setNetlist
SCH_Netlist.setNetlist() 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.
Update the netlist
Signature
typescript
public setNetlist(type: ESYS_NetlistType | undefined, netlist: string): Promise<void>;1
Parameters
Parameter | Type | Description |
|---|---|---|
type | ESYS_NetlistType | undefined | Netlist format |
netlist | string | Netlist data |
Returns
Promise<void>
Example
javascript
try {
// 1. 取出当前网表字符串('Protel2' 对应 ESYS_NetlistType.ALTIUM_DESIGNER)
const netlist = await eda.sch_Netlist.getNetlist('Protel2');
console.log('写回前网表长度:', netlist.length);
// 2. 原样写回当前网表(返回 void,不抛错即表示写回成功)
await eda.sch_Netlist.setNetlist('Protel2', netlist);
// 3. 重新读取,确认网表内容未被破坏
const after = await eda.sch_Netlist.getNetlist('Protel2');
console.log('写回后网表长度:', after.length);
console.log('写回前后一致:', after === netlist);
} catch (e) {
// 原理图数据不满足网表校验(如引脚编号重复)时会抛错
console.log('当前原理图数据不满足网表校验,写回未完成');
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16