Home > PCB_Drc > renameRuleConfiguration
PCB_Drc.renameRuleConfiguration() 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.
Rename the design rule configuration
Signature
typescript
function renameRuleConfiguration(
originalConfigurationName: string,
configurationName: string,
): Promise<boolean>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
originalConfigurationName | string | Original design rule configuration name |
configurationName | string | New design rule configuration name |
Returns
Promise<boolean>
Whether the rename was successful
Remarks
Only custom configurations can be renamed. System configurations cannot be renamed
Example
javascript
// 1. 读取当前配置并保存为待改名的自定义配置(allowOverwrite=true 重复运行安全)
const current = await eda.pcb_Drc.getCurrentRuleConfiguration();
await eda.pcb_Drc.saveRuleConfiguration(current.config, '嘉立创示例_待改配置', true);
// 2. 静默清掉上次运行保留的目标名(首次运行时目标不存在,删除返回 false 属正常)
await eda.pcb_Drc.deleteRuleConfiguration('嘉立创示例_改名后配置');
// 3. 重命名(保留现场供观察)
const result = await eda.pcb_Drc.renameRuleConfiguration('嘉立创示例_待改配置', '嘉立创示例_改名后配置');
console.log('result:', result);1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11