Skip to content

Conversation

@lamaalrajih
Copy link
Owner

Description

This PR adds major new visualization capabilities for debugging and testing KiCad schematics, providing both KiCad CLI integration and a mock renderer fallback for development environments.

special thanks to @laurigates!

Core features:

  • KiCad CLI SVG export with automatic macOS path detection
  • Mock renderer fallback when KiCad CLI is unavailable
  • SVG to PNG conversion using cairosvg
  • Visual comparison tools for before/after screenshots
  • Comprehensive visual testing utilities

New Files Added:

  • kicad_mcp/tools/visualization_tools.py - Main visualization MCP tools
  • kicad_mcp/utils/mock_renderer.py - Fallback renderer for development
  • kicad_mcp/utils/visual_testing.py - Visual testing and comparison utilities
  • test_visualization_standalone.py - Comprehensive test suite

Key Capabilities:

  • export_schematic_svg() - Export .kicad_sch to SVG using CLI or mock
  • convert_svg_to_png() - Convert SVG files to PNG images
  • capture_schematic_screenshot() - End-to-end screenshot generation
  • create_visual_comparison() - Side-by-side comparison images
  • Mock renderer generates schematic visualizations without KiCad

Related Issue(s)

n/a

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)
  • Other (please describe):

Testing Performed

  • Added new unit tests
  • Manually tested on macOS
  • Manually tested on Windows
  • Manually tested on Linux
  • Integration tested with Claude Desktop or other MCP client

Screenshots/Output

Checklist

  • My code follows the project's coding style
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation to reflect my changes
  • My changes generate no new warnings or errors
  • I have checked that my changes work on all supported platforms
  • New and existing unit tests pass with my changes

Additional Notes

Dependencies Added:

  • cairosvg>=2.7.0 - SVG to PNG conversion
  • Pillow>=10.0.0 - Image processing
  • playwright>=1.40.0 - Browser automation (optional)

Benefits:

  • Visual debugging of component positioning issues
  • Screenshot verification of wire connectivity
  • Development workflow without requiring KiCad installation
  • Foundation for visual regression testing in CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants