Home > IPCB_PrimitivePour > convertToFill
IPCB_PrimitivePour.convertToFill() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Convert to: fill primitive (default is the fill region)
Signature
typescript
function convertToFill(): Promise<IPCB_PrimitiveFill>;1
Returns
Promise<IPCB_PrimitiveFill>
Fill primitive object
Example
javascript
// 1. 生成本次运行专用的坐标,避免与之前保留的测试图元重合
const x = 2000 + Math.floor(Math.random() * 100000);
const y = 2000 + Math.floor(Math.random() * 100000);
// 2. 创建一个实心覆铜边框
const polygon = eda.pcb_MathPolygon.createPolygon(['R', x, y, 500, 300, 0, 0]);
const pour = await eda.pcb_PrimitivePour.create('', 1, polygon, 'solid', false, '嘉立创示例_转填充', 5, 10, false);
// 3. 转换为填充图元(原覆铜边框被替换,填充保留现场供观察)
const fill = await pour.convertToFill();
console.log('primitiveType:', `${pour.getState_PrimitiveType()} → ${fill.getState_PrimitiveType()}`);
console.log('primitiveId:', fill.getState_PrimitiveId());1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13