Home > DMT_Schematic > reorderSchematicPages
DMT_Schematic.reorderSchematicPages() 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.
Reorder schematic sheets
Signature
typescript
function reorderSchematicPages(
schematicUuid: string,
schematicPageItemsArray: Array<IDMT_SchematicPageItem>,
): Promise<boolean>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
schematicUuid | string | The UUID of the schematic associated with the sheets being sorted |
schematicPageItemsArray | Array<IDMT_SchematicPageItem> | Array of all schematic sheet properties |
Returns
Promise<boolean>
Sorting whether the operation is successful
Remarks
Here, the array of source schematic sheet properties needs to be obtained through DMT_Schematic.getAllSchematicPagesInfo() or other upstream methods. After sorting the array, pass it in
Example
javascript
// 1. 创建专用测试原理图(自带图页 p1)并再追加两页,凑出可排序的页序列
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.createSchematicPage(schematicUuid);
await new Promise(r => setTimeout(r, 1500));
// 2. 从上游接口取得该原理图的全部图页,输出当前顺序
const allPages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const myPages = allPages.filter(p => p.parentSchematicUuid === schematicUuid);
console.log('orderBefore:', myPages.map(p => p.name).join(' -> '));
// 3. 反转页序列后传入,执行重排
const reversed = [...myPages].reverse();
const reorderOk = await eda.dmt_Schematic.reorderSchematicPages(schematicUuid, reversed);
console.log('reorderOk:', reorderOk);
// 4. 等 1.5s 同步,回读当前页顺序
await new Promise(r => setTimeout(r, 1500));
const after = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
console.log('orderAfter:', (after?.page || []).map(p => p.name).join(' -> '));
// 5. 清理测试原理图,保持工程整洁
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
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27