Home > DMT_Schematic > getCurrentSchematicInfo
DMT_Schematic.getCurrentSchematicInfo() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取当前原理图的详细属性
签名
typescript
function getCurrentSchematicInfo(): Promise<IDMT_SchematicItem | undefined>;1
返回值
Promise<IDMT_SchematicItem | 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);
await eda.dmt_EditorControl.openDocument(info.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 获取当前焦点原理图的详细属性
const current = await eda.dmt_Schematic.getCurrentSchematicInfo();
// 3. 输出原理图的名称、UUID 与图页,确认正是测试原理图
console.log('name:', current?.name);
console.log('schematicUuid:', current?.uuid);
console.log('pages:', (current?.page || []).map(p => p.name).join(', '));
console.log('isFocusedSchematic:', current?.uuid === schematicUuid);
// 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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20