Home > DMT_Schematic > copySchematicPage
DMT_Schematic.copySchematicPage() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
复制原理图图页
签名
typescript
function copySchematicPage(
schematicPageUuid: string,
schematicUuid?: string,
): Promise<string | undefined>;1
2
3
4
2
3
4
参数名
参数 | 类型 | 描述 |
|---|---|---|
schematicPageUuid | string | 源原理图图页 UUID |
schematicUuid | string | (可选) 目标原理图 UUID,如若不指定则为当前原理图 |
返回值
Promise<string | undefined>
新原理图图页 UUID,如若为 undefined 则复制失败
示例
javascript
// 1. 创建专用测试原理图(自带图页 p1 作为复制源),等 1.5s 同步
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
const sourcePageUuid = info.page[0].uuid;
// 2. 复制该图页,目标显式指定为同一原理图,返回新图页 UUID
const copiedUuid = await eda.dmt_Schematic.copySchematicPage(sourcePageUuid, schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本图页,确认名称与归属
const copyPage = await eda.dmt_Schematic.getSchematicPageInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyPageName:', copyPage?.name);
console.log('belongsToSchematic:', copyPage?.parentSchematicUuid === 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