Home > ISCH_PrimitiveComponent > getState_Component
ISCH_PrimitiveComponent.getState_Component() method
Get the property state: associate library device
Signature
typescript
function getState_Component():
{ libraryUuid: string; uuid: string; name?: undefined | string } | undefined;1
2
2
Returns
{ libraryUuid: string; uuid: string; name?: undefined | string } | undefined
Associate library device
Example
javascript
// 1. 放置一个测试器件(SCH 坐标单位 10mil)
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.sch_PrimitiveComponent.create(devices[0], 600, 600);
const compId = comp.getState_PrimitiveId();
// 2. 读取关联的库器件(含所属库 uuid 和器件 uuid)
const component = comp.getState_Component();
// 3. 清理测试器件(查询类需要清理)
await eda.sch_PrimitiveComponent.delete([compId]);
console.log('component:', JSON.stringify(component));1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12