Home > DMT_Pcb > getCurrentPcbInfo
DMT_Pcb.getCurrentPcbInfo() method
Get detailed properties of Current PCB
Signature
typescript
function getCurrentPcbInfo(): Promise<IDMT_PcbItem | undefined>;1
Returns
Promise<IDMT_PcbItem | undefined>
PCB detailed properties of; if it is undefined, the retrieval failed
Remarks
It will get the detailed properties of the currently open PCB that has the last input focus
Example
javascript
// 1. 创建测试 PCB 并打开它,让焦点落到 PCB 文档上(原理图焦点下返回 undefined)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点 PCB 的详细属性
const pcb = await eda.dmt_Pcb.getCurrentPcbInfo();
// 3. 输出 PCB 的名称、UUID 与所属工程
console.log('name:', pcb?.name);
console.log('pcbUuid:', pcb?.uuid);
console.log('parentProjectUuid:', pcb?.parentProjectUuid);
// 4. 清理测试 PCB(PCB 处于打开状态也可以直接删除)
await eda.dmt_Pcb.deletePcb(pcbUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16