feat(schematic): batch component authoring + connection tools

Adds batch authoring tools that collapse the dozens of round-trips needed to
stand up a schematic into a handful: batch_add_components,
batch_edit_schematic_components, replace_schematic_component,
batch_add_no_connects, batch_connect, and batch_add_and_connect (place a set of
parts and wire them in one call). These reuse the existing single-item handlers
internally, so behavior matches exactly.

- python/commands/schematic_batch.py: SchematicBatchCommands(iface)
- python/commands/schematic_text_utils.py: shared .kicad_sch text helpers
- src/tools/schematic-batch.ts + registry 'schematic_batch' category
- python/kicad_interface.py: import + instantiate + dispatch routes
- tests/test_schematic_batch.py: 13 unit tests

Note: schematic_text_utils.py is also shipped by the field-placement and
hierarchy PRs; if those merge first, drop the duplicate copy on rebase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ravi
2026-06-02 19:43:10 -07:00
committed by mixelpixx
parent a0bf45488b
commit 4a251b7343
6 changed files with 1227 additions and 0 deletions

View File

@@ -327,6 +327,7 @@ try:
from commands.schematic import SchematicManager
from commands.schematic_hierarchy import SchematicHierarchyCommands
from commands.schematic_field_layout import SchematicFieldLayoutCommands
from commands.schematic_batch import SchematicBatchCommands
from commands.symbol_creator import SymbolCreator
from commands.symbol_pins import SymbolPinCommands
@@ -453,6 +454,9 @@ class KiCADInterface:
self.hierarchy_commands = SchematicHierarchyCommands(self)
# Schematic field placement / layout-check commands
self.field_layout_commands = SchematicFieldLayoutCommands()
# Batch schematic authoring commands (need an interface back-reference for the
# single-item add/edit/get handlers, footprint library, and sub-sheet fixer)
self.batch_commands = SchematicBatchCommands(self)
# Initialize JLCPCB API integration
self.jlcpcb_client = JLCPCBClient() # Official API (requires auth)
@@ -547,6 +551,13 @@ class KiCADInterface:
"set_schematic_property_position": self.field_layout_commands.set_schematic_property_position,
"batch_set_schematic_property_positions": self.field_layout_commands.batch_set_schematic_property_positions,
"autoplace_schematic_fields": self.field_layout_commands.autoplace_schematic_fields,
# Batch schematic authoring commands
"batch_add_components": self.batch_commands.batch_add_components,
"batch_edit_schematic_components": self.batch_commands.batch_edit_schematic_components,
"replace_schematic_component": self.batch_commands.replace_schematic_component,
"batch_add_no_connects": self.batch_commands.batch_add_no_connects,
"batch_connect": self.batch_commands.batch_connect,
"batch_add_and_connect": self.batch_commands.batch_add_and_connect,
# JLCPCB API commands (complete parts catalog via API)
"download_jlcpcb_database": self._handle_download_jlcpcb_database,
"search_jlcpcb_parts": self._handle_search_jlcpcb_parts,