Home > LIB_Footprint > searchByProperties
LIB_Footprint.searchByProperties() 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.
Search footprints precisely by properties
Signature
typescript
function searchByProperties(
properties: ILIB_FootprintPropertiesForSearch,
libraryUuid?: string,
): Promise<Array<ILIB_FootprintSearchItem>>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
properties | Property | |
libraryUuid | string | (Optional) Library UUID, default is system library, you can use LIB_LibrariesList APIs in |
Returns
Promise<Array<ILIB_FootprintSearchItem>>
List of searched footprint properties
Example
javascript
// 1. 按名称精确搜索(官方属性集合目前仅支持 name)
// 当前版本该接口不稳定:可能抛错,也可能正常返回 undefined,两种都要兼容
let results;
try {
results = await eda.lib_Footprint.searchByProperties({ name: '0402' });
}
catch (e) {
console.log('当前版本按 name 搜索抛错:', e.message);
}
if (!Array.isArray(results))
results = [];
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17