Home > LIB_Device > modify
LIB_Device.modify() 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.
Modify Device
Signature
function modify(
deviceUuid: string,
libraryUuid: string,
deviceName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
association?: {
symbolUuid?: undefined | string;
symbol?: undefined | { uuid: string; libraryUuid: string };
footprintUuid?: undefined | null | string;
footprint?: undefined | null | { uuid: string; libraryUuid: string };
model3D?: undefined | null | { uuid: string; libraryUuid: string };
imageData?: undefined | null | File | Blob;
},
description?: string | null,
property?: {
name?: undefined | null | string;
designator?: undefined | string;
addIntoBom?: undefined | false | true;
addIntoPcb?: undefined | false | true;
net?: undefined | string;
manufacturer?: undefined | null | string;
manufacturerId?: undefined | null | string;
supplier?: undefined | null | string;
supplierId?: undefined | null | string;
otherProperty?:
undefined | Record<string, undefined | null | string | number | false | true>;
},
): Promise<boolean>;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
Parameters
Parameter | Type | Description |
|---|---|---|
deviceUuid | string | Device UUID |
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
deviceName | string | (Optional) Device name |
classification | ILIB_ClassificationIndex | Array<string> | null | (Optional) Classification |
association | { symbolUuid?: undefined | string; symbol?: undefined | { uuid: string; libraryUuid: string }; footprintUuid?: undefined | null | string; footprint?: undefined | null | { uuid: string; libraryUuid: string }; model3D?: undefined | null | { uuid: string; libraryUuid: string }; imageData?: undefined | null | File | Blob } | (Optional) Associated symbol, footprint, image |
description | string | null | (Optional) Description |
property | { name?: undefined | null | string; designator?: undefined | string; addIntoBom?: undefined | false | true; addIntoPcb?: undefined | false | true; net?: undefined | string; manufacturer?: undefined | null | string; manufacturerId?: undefined | null | string; supplier?: undefined | null | string; supplierId?: undefined | null | string; otherProperty?: undefined | Record<string, undefined | null | string | number | false | true> } | (Optional) Other property |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
If you want to clear certain properties, set their values to null
Example
// 1. 获取个人库 UUID 并新建修改对象
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
const deviceUuid = await eda.lib_Device.create(
libraryUuid,
`嘉立创示例_修改前_${Date.now()}`,
[],
{ symbolType: 2 },
'修改前的描述'
);
// 2. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_修改后_${Date.now()}`;
const modified = await eda.lib_Device.modify(deviceUuid, libraryUuid, newName, [], '修改后的描述');
// 3. 再补充修改扩展属性(位号、制造商)
await eda.lib_Device.modify(deviceUuid, libraryUuid, undefined, [], undefined, { designator: 'R', manufacturer: '嘉立创' });
// 修改类保留现场
console.log('deviceUuid:', deviceUuid);
console.log('modified:', modified);
console.log('newName:', newName);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22