Home > IPCB_PrimitiveComponentPad > setState_ParentComponentPrimitiveId
IPCB_PrimitiveComponentPad.setState_ParentComponentPrimitiveId() method
Set the property state: parent device primitive ID
Signature
typescript
function setState_ParentComponentPrimitiveId(): IPCB_PrimitiveComponentPad;1
Returns
Device pad primitive object
Remarks
The properties of this device pad primitive do not support modification. Calling this API will have no effect
Example
javascript
// 1. 放置一个测试器件并获取焊盘图元对象
const devices = await eda.lib_Device.search('C0402');
const comp = await eda.pcb_PrimitiveComponent.create(devices[0], 1, 5000, 5000);
const compId = comp.getState_PrimitiveId();
const pin = (await comp.getAllPins())[0];
// 2. 调用前读取父器件 ID
const before = pin.getState_ParentComponentPrimitiveId();
// 3. 调用修改接口(无参数,实际不产生任何效果)
pin.setState_ParentComponentPrimitiveId();
// 4. 调用后再读一次,确认归属关系未变
const after = pin.getState_ParentComponentPrimitiveId();
console.log('parentUnchanged:', before === after);
console.log('stillBelongToComponent:', after === compId);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