Home > IPCB_PrimitivePolyline > getState_Polygon
IPCB_PrimitivePolyline.getState_Polygon() method
获取属性状态:单多边形
签名
typescript
function getState_Polygon(): IPCB_Polygon;1
返回值
单多边形
示例
javascript
// 1. 创建一条已知轮廓的折线(500 → 拐弯 → 300)
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
const polygon = eda.pcb_MathPolygon.createPolygon([x, y, 'L', x + 500, y, x + 500, y + 300]);
const polyline = await eda.pcb_PrimitivePolyline.create('', 1, polygon, 10, false);
// 2. 读取多边形对象,再取它的轮廓源数组
const currentPolygon = polyline.getState_Polygon();
const source = currentPolygon.getSource();
// 3. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitivePolyline.delete([polyline.getState_PrimitiveId()]);
console.log('polygonSource:', JSON.stringify(source));1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14