Home > PCB_Drc > overwriteNetRules
PCB_Drc.overwriteNetRules() 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.
Overwrite net rules
Signature
typescript
function overwriteNetRules(netRules: Array<Record<string, any>>): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
netRules | Array<Record<string, any>> | Net rules |
Returns
Promise<boolean>
Overwrite whether it is successful
Remarks
It will overwrite all net rules of the current PCB. Please note the risk of data loss
Example
javascript
// 1. 读取当前所有网络规则(数组)
const netRules = await eda.pcb_Drc.getNetRules();
// 2. 整体写回(原样写回演示覆写成功,实际使用时可先增删改数组元素)
const result = await eda.pcb_Drc.overwriteNetRules(netRules);
console.log('ruleCount:', netRules.length);
console.log('result:', result);1
2
3
4
5
6
7
8
2
3
4
5
6
7
8