Home > SCH_Document > autoLayout
SCH_Document.autoLayout() 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.
Auto layout
Signature
typescript
function autoLayout(props?: {
uuids?: undefined | string[];
netlist?:
| undefined
| {
component: Record<
string,
{
pinInfoMap: Record<
string,
{
name: string;
number: string;
net: string;
props: { 'Pin Number': string };
}
>;
}
>;
};
designatorDeviceTypeMap?:
| undefined
| Record<
string,
| 'resistor'
| 'capacitor'
| 'inductive'
| 'diode'
| 'triode'
| 'oscillator'
| 'chip'
| 'otherDevice'
>;
}): Promise<any>;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
28
29
30
31
32
33
34
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
28
29
30
31
32
33
34
Parameters
Parameter | Type | Description |
|---|---|---|
props | { uuids?: undefined | string[]; netlist?: undefined | { component: Record<string, { pinInfoMap: Record<string, { name: string; number: string; net: string; props: { 'Pin Number': string } }> }> }; designatorDeviceTypeMap?: undefined | Record<string, 'resistor' | 'capacitor' | 'inductive' | 'diode' | 'triode' | 'oscillator' | 'chip' | 'otherDevice'> } | (Optional) Auto layout parameter |
Returns
Promise<any>
Auto layout result
Remarks
If no parameters are passed in, auto layout will be performed for all devices
Example
javascript
// 1. 创建测试原理图并打开(文档级 API 作用于当前激活的原理图)
const schematicUuid = await eda.dmt_Schematic.createSchematic();
await new Promise(r => setTimeout(r, 1500));
const schInfo = await eda.dmt_Schematic.getSchematicInfo(schematicUuid);
await eda.dmt_EditorControl.openDocument(schInfo.page[0].uuid);
await new Promise(r => setTimeout(r, 1000));
// 2. 对所有器件执行自动布局(空原理图无器件,立即返回结果对象)
const result = await eda.sch_Document.autoLayout();
console.log('result:', result);
// 3. 清理测试原理图
await new Promise(r => setTimeout(r, 1500));
await eda.dmt_Schematic.deleteSchematic(schematicUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14