Home > DMT_Schematic > createSchematic
DMT_Schematic.createSchematic() 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.
Create Schematic
Signature
typescript
function createSchematic(boardName?: string): Promise<string | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
boardName | string | (Optional) Name of the board it belongs to. If not specified, it is a free schematic |
Returns
Promise<string | undefined>
Schematic UUID, if it is undefined creation fails
Example
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