Home > DMT_Pcb > modifyPcbName
DMT_Pcb.modifyPcbName() method
修改 PCB 名称
签名
typescript
function modifyPcbName(pcbUuid: string, pcbName: string): Promise<boolean>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
pcbUuid | string | PCB UUID |
pcbName | string | PCB 名称 |
返回值
Promise<boolean>
是否修改成功
备注
如若 PCB 已关联复用模块(在工程库内存在同名的复用模块符号),则修改名称时将同步修改复用模块符号名称与关联原理图名称
示例
javascript
// 1. 创建专用测试 PCB 并等 1.5s 同步
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 打开测试 PCB(改名只对已打开的 PCB 生效)
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 3. 修改 PCB 名称
const newName = '嘉立创示例_PCB新名称';
const renamed = await eda.dmt_Pcb.modifyPcbName(pcbUuid, newName);
console.log('renamed:', renamed);
// 4. 等 1s 让改名同步,回读验证(英文名可能被归一化为小写,按不区分大小写比较)
await new Promise(r => setTimeout(r, 1000));
const info = await eda.dmt_Pcb.getPcbInfo(pcbUuid);
console.log('renamedTo:', info?.name);
console.log('renameVerified:', (info?.name ?? '').toLowerCase() === newName.toLowerCase());
// 5. 清理测试 PCB,保持工程整洁
await eda.dmt_Pcb.deletePcb(pcbUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21