Home > PCB_Document > importAutoRouteJsonFile
PCB_Document.importAutoRouteJsonFile() 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.
Import auto routing file (JSON)
Signature
typescript
function importAutoRouteJsonFile(autoRouteFile: File): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
autoRouteFile | File | The JSON file to import |
Returns
Promise<boolean>
Whether the import operation is successful
Remarks
You can use to read in a file
Example
javascript
// 1. 创建测试 PCB 并打开(导入作用于当前激活的 PCB)
const pcbUuid = await eda.dmt_Pcb.createPcb();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_EditorControl.openDocument(pcbUuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 构造布线 JSON 文件对象(真实场景:readFileFromFileSystem 读取外部导出的文件)
const routeFile = new File([JSON.stringify({})], 'auto-route.json', { type: 'application/json' });
// 3. 导入自动布线文件
const imported = await eda.pcb_Document.importAutoRouteJsonFile(routeFile);
console.log('imported:', imported);
// 4. 清理测试 PCB
await eda.dmt_Pcb.deletePcb(pcbUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15