Home > SCH_PrimitiveArc > create
SCH_PrimitiveArc.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.
Create Arc
Signature
function create(
startX: number,
startY: number,
referenceX: number,
referenceY: number,
endX: number,
endY: number,
color?: string | null,
fillColor?: string | null,
lineWidth?: number | null,
lineType?: ESCH_PrimitiveLineType | null,
): Promise<ISCH_PrimitiveArc | undefined>;2
3
4
5
6
7
8
9
10
11
12
Parameters
Parameter | Type | Description |
|---|---|---|
startX | number | Start point X |
startY | number | Start point Y |
referenceX | number | Reference point X |
referenceY | number | Reference point Y |
endX | number | End point X |
endY | number | End point Y |
color | string | null | (Optional) Color, |
fillColor | string | null | (Optional) Fill color. |
lineWidth | number | null | (Optional) Line width, range |
lineType | ESCH_PrimitiveLineType | null | (Optional) Line type. |
Returns
Promise<ISCH_PrimitiveArc | undefined>
Arc primitive object
Example
// 1. 生成随机起点坐标,避免与画布上已有的圆弧重合(SCH 坐标单位 10mil)
const x = 2000 + Math.floor(Math.random() * 8000);
const y = 2000 + Math.floor(Math.random() * 8000);
// 2. 创建一段红色虚线圆弧:起点(x, y),参考点(x+100, y+100),终点(x+200, y),线宽 6
const arc = await eda.sch_PrimitiveArc.create(x, y, x + 100, y + 100, x + 200, y, '#FF0000', null, 6, 1);
// 3. 创建类保留现场,不删除图元
console.log('primitiveId:', arc.getState_PrimitiveId());
console.log('primitiveType:', arc.getState_PrimitiveType());
console.log('startX:', arc.getState_StartX(), 'startY:', arc.getState_StartY());
console.log('referenceX:', arc.getState_ReferenceX(), 'referenceY:', arc.getState_ReferenceY());
console.log('endX:', arc.getState_EndX(), 'endY:', arc.getState_EndY());
console.log('color:', arc.getState_Color());
console.log('lineWidth:', arc.getState_LineWidth());2
3
4
5
6
7
8
9
10
11
12
13
14
15