feat: Expand schematic component support from 3 to 13 types + plan dynamic loading
Issue #26 Follow-up: The original fix only supported 3 component types (R, C, LED). This expands the template-based approach to 13 types while planning for unlimited access. **Expanded Template (Option 1 - Immediate Solution):** - Added 10 new component types to template - Passives: R, C, L, Crystal (4 types) - Semiconductors: D, LED, Q_NPN, Q_NMOS (4 types) - ICs: OpAmp, Voltage Regulator (2 types) - Connectors: Conn_2pin, Conn_4pin (2 types) - Misc: Switch/Button (1 type) **Components Now Supported:** 1. Resistor (R) 2. Capacitor (C) 3. Inductor (L) 4. Crystal (Y) 5. Diode (D) 6. LED 7. NPN Transistor (Q_NPN) 8. N-Channel MOSFET (Q_NMOS) 9. Op-Amp (U) 10. Voltage Regulator (U_REG) 11. 2-pin Connector (J2) 12. 4-pin Connector (J4) 13. Push Button/Switch (SW) **Implementation:** - Created template_with_symbols_expanded.kicad_sch with all 13 types - Updated TEMPLATE_MAP with comprehensive type mappings - Updated project.py to use expanded template by default - All tests passing (13/13 components added successfully) **Future Plan (Option 2 - Dynamic Library Loading):** - Documented comprehensive plan for accessing ALL KiCad symbols (~10,000+) - Dynamic loading from .kicad_sym library files - S-expression injection approach - 6-8 week implementation timeline - Maintains template fallback for compatibility **Files Added:** - python/templates/template_with_symbols_expanded.kicad_sch - docs/DYNAMIC_LIBRARY_LOADING_PLAN.md **Files Modified:** - python/commands/component_schematic.py (expanded TEMPLATE_MAP) - python/commands/project.py (use expanded template) This provides immediate value (13 types vs 3) while we plan the long-term solution of unlimited symbol access through dynamic library loading. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,11 +58,11 @@ class ProjectCommands:
|
||||
board.SetFileName(board_path)
|
||||
pcbnew.SaveBoard(board_path, board)
|
||||
|
||||
# Create schematic from template (use template_with_symbols for component cloning support)
|
||||
# Create schematic from template (use expanded template with many component types)
|
||||
schematic_path = project_path.replace(".kicad_pro", ".kicad_sch")
|
||||
template_sch_path = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
'..', 'templates', 'template_with_symbols.kicad_sch'
|
||||
'..', 'templates', 'template_with_symbols_expanded.kicad_sch'
|
||||
)
|
||||
|
||||
if os.path.exists(template_sch_path):
|
||||
|
||||
Reference in New Issue
Block a user