Home > PCB_Layer > getAllLayers
PCB_Layer.getAllLayers() 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 the detailed properties of all layers
Signature
typescript
function getAllLayers(): Promise<Array<IPCB_LayerItem>>;1
Returns
Promise<Array<IPCB_LayerItem>>
Detailed properties of all layers
Example
javascript
// 1. 一次性取回当前 PCB 的全部图层
const layers = await eda.pcb_Layer.getAllLayers();
// 2. 查看顶层(TOP=1)的典型属性
const top = layers.find(l => l.id === 1);
// 3. 统计信号层(铜箔层)数量
const copperCount = layers.filter(l => l.type === 'SIGNAL').length;
console.log('totalCount:', layers.length);
console.log('topLayerName:', top?.name);
console.log('topLayerColor:', top?.color);
console.log('topLayerLocked:', top?.locked);
console.log('copperLayerCount:', copperCount);1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14