Home > DMT_Schematic > createSchematic
DMT_Schematic.createSchematic() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建原理图
签名
typescript
function createSchematic(boardName?: string): Promise<string | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
boardName | string | (可选) 所属板子名称,如若不指定则为游离原理图 |
返回值
Promise<string | undefined>
原理图 UUID,如若为 undefined 则创建失败
示例
javascript
// 1. 创建原理图(不指定 boardName,得到游离原理图),返回新原理图 UUID
const schematicUuid = await eda.dmt_Schematic.createSchematic();
console.log('schematicUuid:', schematicUuid);
// 2. 等 1.5s 让原理图在工作区落地,回读确认(自带图页 p1)
await new Promise(r => setTimeout(r, 1500));
const info = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('name:', info?.name);
console.log('pages:', (info?.page || []).map(p => p.name).join(', '));
console.log('parentBoardName:', info?.parentBoardName);
// 3. 删除本例创建的原理图,保持工程整洁
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15