Home > DMT_EditorControl > openLibraryDocument
DMT_EditorControl.openLibraryDocument() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
打开库符号、封装文档
签名
typescript
function openLibraryDocument(
libraryUuid: string,
libraryType: ELIB_LibraryType.SYMBOL | ELIB_LibraryType.FOOTPRINT,
uuid: string,
splitScreenId?: string,
): Promise<string | undefined>;1
2
3
4
5
6
2
3
4
5
6
参数名
参数 | 类型 | 描述 |
|---|---|---|
libraryUuid | string | 库 UUID,可以使用 LIB_LibrariesList 内的接口获取 |
libraryType | 库类型,支持符号和封装 | |
uuid | string | 符号、封装 UUID |
splitScreenId | string | (可选) 分屏 ID,即 DMT_EditorControl.getSplitScreenTree() 方法获取到的 IDMT_EditorSplitScreenItem.id |
返回值
Promise<string | undefined>
标签页 ID,如若为 undefined,则打开文档失败
示例
javascript
// 1. 搜索库符号,拿到其所在库 UUID 与符号 UUID
const results = await eda.lib_Symbol.search('0603');
console.log('symbol:', results[0].name);
// 2. 打开该符号的编辑画布,返回标签页 ID('2' = ELIB_LibraryType.SYMBOL)
const tabId = await eda.dmt_EditorControl.openLibraryDocument(results[0].libraryUuid, '2', results[0].uuid);
console.log('tabId:', tabId);
// 3. 看完关闭标签页
const closed = await eda.dmt_EditorControl.closeDocument(tabId);
console.log('closed:', closed);1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11