Home > DMT_Schematic > getCurrentSchematicPageInfo
DMT_Schematic.getCurrentSchematicPageInfo() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取当前原理图图页的详细属性
签名
typescript
public getCurrentSchematicPageInfo(): Promise<IDMT_SchematicPageItem | undefined>;1
返回值
Promise<IDMT_SchematicPageItem | undefined>
原理图图页的详细属性,如若为 undefined 则获取失败
备注
将会获取当前打开且拥有最后输入焦点的原理图图页的详细属性
示例
javascript
// 1. 创建专用测试原理图(自带图页 p1)并打开该页,让焦点落到测试页上
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const pageUuid = info.page[0].uuid;
await eda.dmt_EditorControl.openDocument(pageUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点图页的详细属性
const currentPage = await eda.dmt_Schematic.getCurrentSchematicPageInfo();
// 3. 输出图页名称、UUID、所属原理图与明细表开关,确认正是测试页
console.log('name:', currentPage?.name);
console.log('pageUuid:', currentPage?.uuid);
console.log('parentSchematicUuid:', currentPage?.parentSchematicUuid);
console.log('showTitleBlock:', currentPage?.showTitleBlock);
console.log('isFocusedPage:', currentPage?.uuid === pageUuid);
// 4. 清理测试原理图(处于打开状态也可以直接删除)
await new Promise(r => setTimeout(r, 1000));
const deleted = await eda.dmt_Schematic.deleteSchematic(schematicUuid);
console.log('deleted:', deleted);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22