Home > PCB_Drc > saveRuleConfiguration
PCB_Drc.saveRuleConfiguration() 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.
Save Design rule configuration
Signature
typescript
function saveRuleConfiguration(
ruleConfiguration: Record<string, any>,
configurationName: string,
allowOverwrite?: boolean,
): Promise<boolean>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
ruleConfiguration | Record<string, any> | Design rule configuration |
configurationName | string | Configuration name |
allowOverwrite | boolean | (Optional) Whether to allow overwriting a design rule configuration with the same name. If |
Returns
Promise<boolean>
Save Whether Successful
Remarks
Only custom configurations can be overwritten and saved. System configurations cannot be modified or overwritten
Example
javascript
// 1. 读取当前设计规则配置作为数据源(规则数据在 config 字段里)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
// 2. 另存为自定义配置,允许同名覆盖(保留现场供观察)
const saved = await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_规则配置', true);
console.log('saved:', saved);1
2
3
4
5
6
7
2
3
4
5
6
7