Home > IPCB_PrimitiveArc > getAdjacentPrimitives
IPCB_PrimitiveArc.getAdjacentPrimitives() 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.
Get Adjacent primitive objects
Signature
typescript
function getAdjacentPrimitives(): Promise<
Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc>
>;1
2
3
2
3
Returns
Promise<Array<IPCB_PrimitiveLine | IPCB_PrimitiveVia | IPCB_PrimitiveArc>>
Adjacent line, via, and arc-line primitive objects
Remarks
It will get the line, via, and arc-line primitive objects directly connected to the arc line
Example
javascript
// 1. 创建一条直线走线,终点落在 (7500, 7000)
const line = await eda.pcb_PrimitiveLine.create('', 1, 7000, 7000, 7500, 7000, 10);
// 2. 创建一段圆弧,起点与直线终点重合,两段构成一整段导线
const arc = await eda.pcb_PrimitiveArc.create('', 1, 7500, 7000, 7800, 7300, 90, 10, 1, false);
// 3. 获取与圆弧直接相连的图元,并读出各自的类型
const adjacent = await arc.getAdjacentPrimitives();
// 4. 清理测试图元(查询类案例不留测试对象)
await eda.pcb_PrimitiveLine.delete([line]);
await eda.pcb_PrimitiveArc.delete([arc]);
console.log('adjacent count:', adjacent.length);
adjacent.forEach((p, i) => {
console.log(`adjacent[${i}] type:`, p.getState_PrimitiveType());
});1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17