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:
@@ -10,11 +10,39 @@ class ComponentManager:
|
||||
|
||||
# Template symbol references mapping component type to template reference
|
||||
TEMPLATE_MAP = {
|
||||
# Passives
|
||||
'R': '_TEMPLATE_R',
|
||||
'C': '_TEMPLATE_C',
|
||||
'L': '_TEMPLATE_L',
|
||||
'Y': '_TEMPLATE_Y',
|
||||
'Crystal': '_TEMPLATE_Y',
|
||||
|
||||
# Semiconductors
|
||||
'D': '_TEMPLATE_D',
|
||||
'LED': '_TEMPLATE_D',
|
||||
# Add more mappings as needed
|
||||
'LED': '_TEMPLATE_LED',
|
||||
'Q': '_TEMPLATE_Q_NPN',
|
||||
'Q_NPN': '_TEMPLATE_Q_NPN',
|
||||
'Q_NMOS': '_TEMPLATE_Q_NMOS',
|
||||
'MOSFET': '_TEMPLATE_Q_NMOS',
|
||||
|
||||
# ICs
|
||||
'U': '_TEMPLATE_U_OPAMP',
|
||||
'OpAmp': '_TEMPLATE_U_OPAMP',
|
||||
'IC': '_TEMPLATE_U_OPAMP',
|
||||
'U_REG': '_TEMPLATE_U_REG',
|
||||
'Regulator': '_TEMPLATE_U_REG',
|
||||
|
||||
# Connectors
|
||||
'J': '_TEMPLATE_J2',
|
||||
'J2': '_TEMPLATE_J2',
|
||||
'J4': '_TEMPLATE_J4',
|
||||
'Conn_2': '_TEMPLATE_J2',
|
||||
'Conn_4': '_TEMPLATE_J4',
|
||||
|
||||
# Misc
|
||||
'SW': '_TEMPLATE_SW',
|
||||
'Button': '_TEMPLATE_SW',
|
||||
'Switch': '_TEMPLATE_SW',
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user