Home > IPCB_PrimitivePour > convertToFill
IPCB_PrimitivePour.convertToFill() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
转换到:填充图元(默认是填充区域)
签名
typescript
function convertToFill(): Promise<IPCB_PrimitiveFill>;1
返回值
Promise<IPCB_PrimitiveFill>
填充图元对象
示例
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