KiCAD MCP Bot
62d97f1fa6
feat: Dynamic symbol loading - CORE FUNCTIONALITY WORKING! 🎉
**MAJOR BREAKTHROUGH:** Implemented dynamic symbol loading from KiCad library files!
This eliminates the 13-component limitation and enables access to ALL KiCad symbols.
**What Works (Phase A Complete):**
✅ Symbol extraction from .kicad_sym library files
✅ S-expression parsing and manipulation
✅ Dynamic injection of symbols into schematics
✅ Template instance creation for cloning
✅ Full end-to-end workflow tested successfully
**Test Results:**
- Loaded 5 symbols dynamically (R, C, LED, L, D) from Device.kicad_sym
- Injected symbol definitions into schematic's lib_symbols section
- Created template instances at offscreen positions
- Successfully cloned components from dynamic templates
- All operations work with kicad-skip library
**New File:**
- python/commands/dynamic_symbol_loader.py (400+ lines)
- DynamicSymbolLoader class
- find_kicad_symbol_libraries() - cross-platform library discovery
- parse_library_file() - S-expression parsing with caching
- extract_symbol_definition() - extract specific symbols
- inject_symbol_into_schematic() - inject symbols into lib_symbols
- create_template_instance() - create cloneable templates
- load_symbol_dynamically() - complete workflow
**Modified:**
- python/commands/component_schematic.py
- Added dynamic loader integration hooks
- get_or_create_template() method for hybrid approach
- Falls back to static templates gracefully
**How It Works:**
1. Parse .kicad_sym file with sexpdata library
2. Extract specific symbol definition (S-expression tree)
3. Inject into schematic's lib_symbols section
4. Create offscreen template instance (_TEMPLATE_Device_R)
5. kicad-skip can clone() the template to create components
**Benefits:**
- Access to ~10,000+ standard KiCad symbols
- No manual template maintenance required
- Works with ANY .kicad_sym library file
- Maintains static template fallback
**Next Steps (Integration):**
- Wire through MCP interface layer (has schematic path)
- Create add_schematic_component_dynamic MCP tool
- Add symbol search/discovery tools
- Cross-platform testing (Windows, macOS)
**Technical Notes:**
- Uses sexpdata library for S-expression manipulation
- Caches parsed libraries for performance
- Generates unique UUIDs for template instances
- Positions templates offscreen (y = -100 - offset)
- Preserves schematic structure and formatting
This is a MASSIVE step forward! The hardest part (S-expression manipulation
and template injection) is DONE and WORKING. 🚀
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 10:10:57 -05:00
..
2026-01-10 10:10:57 -05:00
2025-12-03 08:48:37 -05:00
2025-11-05 21:50:33 -05:00
2025-11-05 21:50:33 -05:00
2026-01-10 09:54:51 -05:00
2025-12-28 11:29:09 -05:00
2026-01-10 09:04:56 -05:00
2025-10-25 20:48:00 -04:00
2025-11-30 14:33:27 -05:00