Home > PCB_Layer > setLayerInvisible
PCB_Layer.setLayerInvisible() 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 invisible
Signature
typescript
function setLayerInvisible(
layer?: TPCB_LayersInTheSelectable | Array<TPCB_LayersInTheSelectable>,
setOtherLayerVisible?: 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 |
setOtherLayerVisible | boolean | (Optional) Whether to set other layers to visible |
Returns
Promise<boolean>
Whether the operation is successful
Example
javascript
// 1. 隐藏底层丝印层(BOTTOM_SILKSCREEN=4)
const hideResult = await eda.pcb_Layer.setLayerInvisible(4);
// 2. 从图层列表确认显隐状态(HIDDEN=2)
const layers = await eda.pcb_Layer.getAllLayers();
const silk = layers.find(l => l.id === 4);
// 3. 恢复可见,避免影响后续查看
const restoreResult = await eda.pcb_Layer.setLayerVisible(4);
console.log('hideResult:', hideResult);
console.log('silkLayerStatus:', silk?.layerStatus);
console.log('restoreResult:', restoreResult);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