Home > PCB_Layer > setLayerVisible
PCB_Layer.setLayerVisible() 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.
Set the layer to visible
Signature
typescript
function setLayerVisible(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
setOtherLayerInvisible?: boolean,
): Promise<boolean>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
layer | TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable> | (Optional) Layer. If no layer is specified, all layers are used by default |
setOtherLayerInvisible | boolean | (Optional) Whether to set other layers to invisible |
Returns
Promise<boolean>
Whether the operation is successful
Example
javascript
// 1. 先隐藏底层丝印层(BOTTOM_SILKSCREEN=4)制造初始状态
await eda.pcb_Layer.setLayerInvisible(4);
// 2. 恢复底层丝印层可见
const showResult = await eda.pcb_Layer.setLayerVisible(4);
// 3. 从图层列表确认显隐状态(SHOW=1)
const layers = await eda.pcb_Layer.getAllLayers();
const silk = layers.find(l => l.id === 4);
console.log('showResult:', showResult);
console.log('silkLayerStatus:', silk?.layerStatus);1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12