简体中文
Home > PNL_PrimitiveEllipse > create
PNL_PrimitiveEllipse.create() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建椭圆图元
签名
typescript
function create(params: IPNL_EllipseCreateParameters): Promise<IPNL_PrimitiveEllipse | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
params | 椭圆创建参数,见 IPNL_EllipseCreateParameters |
返回值
Promise<IPNL_PrimitiveEllipse | undefined>
创建的椭圆图元对象,创建失败抛出中文错误
备注
坐标为笛卡尔坐标系(Y 轴向上为正),centerX / centerY 为椭圆心坐标,radiusX / radiusY 为长短半径,两者相等即为正圆
rotation 为绕椭圆心逆时针旋转的角度(度),旋转时椭圆心保持不动
ADD since EDA v4.1.105
示例
javascript
// 1. 创建椭圆(椭圆心在原点上方 100)
const ellipse = await eda.pnl_PrimitiveEllipse.create({ centerX: 100, centerY: 100, radiusX: 100, radiusY: 60 });
// 2. 创建正圆 + 自定义样式
const circle = await eda.pnl_PrimitiveEllipse.create({
centerX: 400,
centerY: 100,
radiusX: 80,
radiusY: 80,
strokeColor: '#FF6600',
fillColor: '#FFEE00',
strokeWidth: 3,
});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