Layers
Request layer snapshots and update CAD layer visibility from the host.
Layer workflows let the host inspect the current CAD layer list and control visibility using the identifiers returned by the viewer.
This is the right entry point when your UI needs discipline filters, drawing legend controls, or quick hide/show operations for named layer groups.
- Request current layer state with `getLayers`.
- Listen for `layersSnapshot` and render the returned collection.
- Send `setLayerVisibility` with one or more selectors to update visibility.
Start by requesting the current snapshot, then use the returned indexes, ids, or names when updating visibility.
Request layers
Listen for layersSnapshot
Hide by layer name
Show all layers
The host owns the panel state, but the viewer remains the source of truth for the live layer list.
1. Host requests layers
Call `getLayers` when the CAD panel opens or when the active file changes.
2. Viewer returns layersSnapshot
The viewer responds with a normalized list of layers, including names, ids, visibility, and kind.
3. Host posts visibility updates
Use the snapshot fields to target the exact layer or collection that should be hidden or shown.
This pattern is enough to build a simple layer panel with host-side rendering and viewer-side state.
Use the related pages below when you need the matching block workflow or the full payload reference.
- Blocks: Blocks
- Technical Reference: API References
- CAD Overview: Overview
