kicad-mcp/docs/thumbnail_guide.md
Lama f50a2ce1af Enhance PCB thumbnail generation with robust fallback methods
Implements a more reliable PCB thumbnail generation feature using two methods:
- Primary: pcbnew Python module for high-quality rendering
- Fallback: pcbnew_cli for environments without Python modules

Adds detailed progress reporting and comprehensive error handling.
Includes documentation in docs/thumbnail_guide.md.
2025-03-20 03:16:14 -04:00

2.9 KiB

PCB Thumbnail Feature Guide

The KiCad MCP Server now includes a powerful PCB thumbnail generation feature, making it easier to visually browse and identify your KiCad projects. This guide explains how to use the feature and how it works behind the scenes.

Using the PCB Thumbnail Feature

You can generate thumbnails for your KiCad PCB designs directly through Claude:

Please generate a thumbnail for my KiCad project at /path/to/my_project/my_project.kicad_pro

The tool will:

  1. Find the PCB file (.kicad_pcb) associated with your project
  2. Generate a visual representation of your PCB layout
  3. Return an image that you can view directly in Claude

How It Works

The thumbnail generator uses multiple methods to create PCB thumbnails, automatically falling back to alternative approaches if the primary method fails:

  1. pcbnew Python Module (Primary Method)

    • Uses KiCad's official Python API for the most accurate representation
    • Renders the PCB with proper layers, components, and traces
    • Requires the KiCad Python modules to be installed and accessible
  2. Command Line Interface (Fallback Method)

    • Uses KiCad's command-line tools (pcbnew_cli) when Python modules aren't available
    • Creates high-quality renders similar to what you'd see in KiCad's PCB editor
    • Works across different operating systems (macOS, Windows, Linux)

Thumbnail Examples

When viewing a PCB thumbnail, you'll typically see:

  • The PCB board outline (Edge.Cuts layer)
  • Copper layers (F.Cu and B.Cu)
  • Silkscreen layers (F.SilkS and B.SilkS)
  • Mask layers (F.Mask and B.Mask)
  • Component outlines and reference designators

Tips for Best Results

For optimal thumbnail quality:

  1. Ensure KiCad is properly installed - The thumbnail generator relies on KiCad's libraries and tools
  2. Use the full absolute path to your project file to avoid path resolution issues
  3. Make sure your PCB has a defined board outline (Edge.Cuts layer) for proper visualization
  4. Update to the latest KiCad version for best compatibility with the thumbnail generator

Troubleshooting

If you encounter issues:

  • No thumbnail generated: Check that your project exists and contains a valid PCB file
  • Low-quality thumbnail: Ensure your PCB has a properly defined board outline
  • "pcbnew module not found": This is expected if KiCad's Python modules aren't in your Python path

Integration Ideas

The PCB thumbnail feature can be used in various ways:

  1. Project browsing: Generate thumbnails for all your projects to visually identify them
  2. Documentation: Include PCB thumbnails in your project documentation
  3. Design review: Use thumbnails to quickly check PCB layouts during discussions

Future Enhancements

The thumbnail generation feature will be expanded in future releases with:

  • Higher quality rendering options
  • Layer selection capabilities
  • 3D rendering of PCB assemblies
  • Annotation and markup support for design review