Home > SCH_Document > importChanges
SCH_Document.importChanges() method
从 PCB 导入变更
签名
typescript
function importChanges(): Promise<boolean>;1
返回值
Promise<boolean>
导入操作是否成功,导入失败或游离原理图返回 false
示例
javascript
// 1. 创建测试原理图和测试 PCB
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
// 2. 创建板子把原理图与 PCB 关联起来(返回板子名称)
const boardName = await eda.dmt_Board.createBoard(schematicUuid, pcbUuid);
await new Promise(r => setTimeout(r, 1500));
console.log('boardName:', boardName);
// 3. 打开原理图(图页级 UUID),从关联 PCB 导入变更
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
const imported = await eda.sch_Document.importChanges();
console.log('imported:', imported);
// 4. 清理:删板子、删 PCB、删原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Board.deleteBoard(boardName);
await new Promise(r => setTimeout(r, 1000));
await eda.dmt_Pcb.deletePcb(pcbUuid);
await new Promise(r => setTimeout(r, 500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25