Home > DMT_Pcb > modifyPcbName
DMT_Pcb.modifyPcbName() method
Modify PCB name
Signature
typescript
function modifyPcbName(pcbUuid: string, pcbName: string): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
pcbUuid | string | PCB UUID |
pcbName | string | PCB name |
Returns
Promise<boolean>
Whether Modify Successful
Remarks
If the PCB is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), modifying the name will also modify the reuse block symbol name and the associated schematic name
Example
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