Home > LIB_Footprint > getDocumentSource
LIB_Footprint.getDocumentSource() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
获取封装的文档源码
签名
typescript
function getDocumentSource(
footprintUuid: string,
libraryUuid?: string,
): Promise<string | undefined>;1
2
3
4
2
3
4
参数名
参数 | 类型 | 描述 |
|---|---|---|
footprintUuid | string | 封装 UUID |
libraryUuid | string | (可选) 库 UUID,默认为系统库,可以使用 LIB_LibrariesList 内的接口获取 |
返回值
Promise<string | undefined>
封装的 3.0 文档源码(efoo JSON 字符串),获取失败返回 undefined
备注
与 LIB_Footprint.updateDocumentSource() 对称的读取接口;返回 **3.0 格式**(efoo)的封装源数据, 可直接用于组装 PCB 源数据(如 AI 生成 eprj3 工程)。
支持工程库 / 非工程库(系统库 / 个人库 / 扩展库): - 工程库:从当前打开的工程 worker 读取(含未保存内容); - 非工程库:从 lib.worker 读取(含未保存内容),worker 无缓存时回退网络获取, 自动处理 history_uuid(历史版本)、dataStrId(远程存储)与 2.0 → 3.0 格式转换。
获取失败(如库条目不存在)将返回 undefined