Home > DMT_Schematic > copySchematic
DMT_Schematic.copySchematic() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Copy Schematic
Signature
typescript
public copySchematic(schematicUuid: string, boardName?: string): Promise<string | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
schematicUuid | string | Source schematic UUID |
boardName | string | (Optional) Name of the board the new schematic belongs to. If not specified, it is a free schematic |
Returns
Promise<string | undefined>
New schematic UUID. If it is undefined, the copy failed
Remarks
If the schematic is already associated with a reuse block (a reuse block symbol with the same name exists in the project library), copying the schematic will also create a new reuse block symbol
Example
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