English
Home > PNL_PrimitiveEllipse > create
PNL_PrimitiveEllipse.create() 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.
创建椭圆图元
Signature
typescript
function create(params: IPNL_EllipseCreateParameters): Promise<IPNL_PrimitiveEllipse | undefined>;1
Parameters
Parameter | Type | Description |
|---|---|---|
params | 椭圆创建参数,见 IPNL_EllipseCreateParameters |
Returns
Promise<IPNL_PrimitiveEllipse | undefined>
创建的椭圆图元对象,创建失败抛出中文错误
Remarks
坐标为笛卡尔坐标系(Y 轴向上为正),centerX / centerY 为椭圆心坐标,radiusX / radiusY 为长短半径,两者相等即为正圆
rotation 为绕椭圆心逆时针旋转的角度(度),旋转时椭圆心保持不动 ADD since EDA v4.1.105
Example
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