Home > PCB_MathPolygon > createComplexPolygon
PCB_MathPolygon.createComplexPolygon() method
Create Complex polygon
Signature
typescript
function createComplexPolygon(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| Array<IPCB_Polygon>,
): IPCB_ComplexPolygon | undefined;1
2
3
4
5
6
7
2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
complexPolygon | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | Array<IPCB_Polygon> | Complex polygon data |
Returns
IPCB_ComplexPolygon | undefined
Complex polygon object. undefined indicates that the data is invalid
Example
javascript
// 1. 传入两个源数组的数组,创建矩形外框加圆形第二块的复杂多边形(纯数据对象,画布上还看不到)
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 1000, 1000, 500, 300, 0, 0],
['CIRCLE', 3000, 1150, 100],
]);
// 2. 读取复杂多边形的分块源数据,确认两块都被解析
const sources = complexPolygon.getSourceStrictComplex();
sources.forEach((source, index) => {
console.log(`source${index + 1}:`, JSON.stringify(source));
});
console.log('count:', sources.length);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12