Home > DMT_Schematic > copySchematic
DMT_Schematic.copySchematic() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
复制原理图
签名
typescript
public copySchematic(schematicUuid: string, boardName?: string): Promise<string | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
schematicUuid | string | 源原理图 UUID |
boardName | string | (可选) 新原理图所属板子名称,如若不指定则为游离原理图 |
返回值
Promise<string | undefined>
新原理图 UUID,如若为 undefined 则复制失败
备注
如若原理图已关联复用模块(在工程库内存在同名的复用模块符号),则复制原理图时将同步新建复用模块符号
示例
javascript
// 1. 创建专用源原理图(自带图页 p1),等 1.5s 同步
const sourceUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
// 2. 复制源原理图,返回副本 UUID
const copiedUuid = await eda.dmt_Schematic.copySchematic(sourceUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本,确认名称与图页被完整复制
const copyInfo = await eda.dmt_Schematic.getSchematicInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyName:', copyInfo?.name);
console.log('copyPages:', (copyInfo?.page || []).map(p => p.name).join(', '));
// 4. 清理本例创建的两个原理图(先删副本再删源),保持工程整洁
await new Promise(r => setTimeout(r, 1000));
const deletedCopy = await eda.dmt_Schematic.deleteSchematic(copiedUuid);
console.log('deleted:', deletedCopy);
await new Promise(r => setTimeout(r, 1000));
const deletedSource = await eda.dmt_Schematic.deleteSchematic(sourceUuid);
console.log('deleted:', deletedSource);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21