| name | klayoutclaw:visual |
| description | Capture the current KLayout layout as a PNG image for visual inspection. Use this skill whenever the user wants to see, view, screenshot, preview, or visually inspect the current layout. Also trigger when the user asks "what does it look like", "show me the layout", "take a screenshot", "capture the design", or needs a visual check of their GDS geometry. |
KLayout Visual Capture
Save the current KLayout layout to a temporary GDS file, convert it to PNG, and return both file paths for visual inspection.
Prerequisites
- KLayout running with KlayoutClaw plugin (v0.3+)
- A layout with geometry must be open
- Python packages:
gdstk, matplotlib, numpy (available in the instrMCPdev conda env)
Script
capture.py — Capture layout as PNG
python scripts/capture.py [--output path.png] [--gds path.gds] [--dpi 200]
--output — PNG output path. If the user has a working directory or stack path, save there instead of /tmp.
--gds — GDS output path. Same rule: prefer the user's working directory over /tmp.
--dpi — Image resolution (default: 200)
Returns the paths to both the GDS and PNG files, printed to stdout.
Example:
python scripts/capture.py
How It Works
- Calls
save_layout via MCP to write the current layout to a temp GDS file
- Runs
tools/gds_to_image.py from the KlayoutClaw repo to convert GDS to PNG
- Prints both file paths
The GDS-to-PNG conversion uses gdstk to parse the GDS and matplotlib to render all layers with distinct colors and a legend.
After Capture
Use the Read tool on the PNG path to view the image directly in the conversation. This gives immediate visual feedback on layout geometry.