Home > IPCB_PrimitiveAttribute > getState_AlignMode
IPCB_PrimitiveAttribute.getState_AlignMode() method
Get the property state: alignment mode
Signature
typescript
function getState_AlignMode(): EPCB_PrimitiveStringAlignMode;1
Returns
Alignment mode
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();
// 2. 取出器件的属性图元,定位 Designator(编号)属性
const attrIds = await eda.pcb_PrimitiveAttribute.getAllPrimitiveId(compId);
const attrs = await eda.pcb_PrimitiveAttribute.get(attrIds);
const designator = attrs.find(a => a.getState_Key() === 'Designator');
// 3. 读取文本对齐模式
const alignMode = designator.getState_AlignMode();
// 4. 清理测试器件(属性图元随器件一起删除)
await eda.pcb_PrimitiveComponent.delete([compId]);
console.log('alignMode:', alignMode);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