Home > DMT_Board > getCurrentBoardInfo
DMT_Board.getCurrentBoardInfo() method
获取当前板子的详细属性
签名
typescript
function getCurrentBoardInfo(): Promise<IDMT_BoardItem | undefined>;1
返回值
Promise<IDMT_BoardItem | undefined>
板子的详细属性,如若为 undefined 则获取失败
备注
将会获取当前打开且拥有最后输入焦点的原理图、PCB 所关联的板子的详细属性
示例
javascript
// 1. 切换到第一块板子下属的 PCB 文档(工程里可能存在不属于任何板子的 PCB,不能直接取 getAllPcbsInfo()[0])
const boards = await eda.dmt_Board.getAllBoardsInfo();
await eda.dmt_EditorControl.openDocument(boards[0].pcb.uuid);
await new Promise(r => setTimeout(r, 500));
// 2. 获取当前焦点对应的板子
const board = await eda.dmt_Board.getCurrentBoardInfo();
// 3. 输出板子属性
console.log('name:', board.name);
console.log('schematic:', board.schematic?.uuid);
console.log('pcb:', board.pcb?.uuid);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12