Home > LIB_Device > create
LIB_Device.create() 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 Device
Signature
function create(
libraryUuid: string,
deviceName: string,
classification?: ILIB_ClassificationIndex | Array<string>,
association?: {
symbolType?:
| undefined
| ELIB_SymbolType.COMPONENT
| ELIB_SymbolType.NET_FLAG
| ELIB_SymbolType.NET_PORT
| ELIB_SymbolType.DRAWING
| ELIB_SymbolType.NON_ELECTRICAL
| ELIB_SymbolType.SHORT_CIRCUIT_FLAG
| ELIB_SymbolType.OFF_PAGE_CONNECTOR
| ELIB_SymbolType.DIFFERENTIAL_PAIRS_FLAG
| ELIB_SymbolType.CBB_SYMBOL;
symbolUuid?: undefined | string;
symbol?: undefined | { uuid: string; libraryUuid: string };
footprintUuid?: undefined | string;
footprint?: undefined | { uuid: string; libraryUuid: string };
model3D?: undefined | { uuid: string; libraryUuid: string };
imageData?: undefined | File | Blob;
},
description?: string,
property?: ILIB_DeviceExtendPropertyItem,
): Promise<string | undefined>;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
Parameters
Parameter | Type | Description |
|---|---|---|
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
deviceName | string | Device name |
classification | ILIB_ClassificationIndex | Array<string> | (Optional) Classification |
association | { symbolType?: undefined | ELIB_SymbolType.COMPONENT | ELIB_SymbolType.NET_FLAG | ELIB_SymbolType.NET_PORT | ELIB_SymbolType.DRAWING | ELIB_SymbolType.NON_ELECTRICAL | ELIB_SymbolType.SHORT_CIRCUIT_FLAG | ELIB_SymbolType.OFF_PAGE_CONNECTOR | ELIB_SymbolType.DIFFERENTIAL_PAIRS_FLAG | ELIB_SymbolType.CBB_SYMBOL; symbolUuid?: undefined | string; symbol?: undefined | { uuid: string; libraryUuid: string }; footprintUuid?: undefined | string; footprint?: undefined | { uuid: string; libraryUuid: string }; model3D?: undefined | { uuid: string; libraryUuid: string }; imageData?: undefined | File | Blob } | (Optional) Associate a symbol, footprint, and image. Specifying |
description | string | (Optional) Description |
property | (Optional) Other property, only |
Returns
Promise<string | undefined>
Device UUID
Example
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建器件:新建元件符号(symbolType: 2)并设置默认属性
const deviceName = `嘉立创示例_新器件_${Date.now()}`;
const deviceUuid = await eda.lib_Device.create(
libraryUuid,
deviceName,
[],
{ symbolType: 2 },
'示例器件描述',
{ designator: 'R', addIntoBom: true, addIntoPcb: true }
);
// 创建类保留现场(新器件留在个人库中供观察)
console.log('deviceUuid:', deviceUuid);
console.log('deviceName:', deviceName);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18