From 2956b4fa9dc2ad75fa6d7598dbb7d77aa016aa65 Mon Sep 17 00:00:00 2001 From: Eugene Mikhantyev Date: Fri, 13 Mar 2026 00:27:17 +0000 Subject: [PATCH] fix: use _elements.remove() for kicad-skip collections lacking remove method ElementCollection in kicad-skip doesn't implement remove(), causing 'WireCollection object has no attribute remove' errors. Access the underlying _elements list directly for wire, label, and symbol deletion. Co-Authored-By: Claude Opus 4.6 --- python/commands/component_schematic.py | 2 +- python/kicad_interface.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/commands/component_schematic.py b/python/commands/component_schematic.py index ef66224..79b0006 100644 --- a/python/commands/component_schematic.py +++ b/python/commands/component_schematic.py @@ -253,7 +253,7 @@ class ComponentManager: break if symbol_to_remove: - schematic.symbol.remove(symbol_to_remove) + schematic.symbol._elements.remove(symbol_to_remove) print(f"Removed component {component_ref} from schematic.") return True else: diff --git a/python/kicad_interface.py b/python/kicad_interface.py index 664610e..f1a5466 100644 --- a/python/kicad_interface.py +++ b/python/kicad_interface.py @@ -1933,7 +1933,7 @@ class KiCADInterface: break if wire_to_remove: - schematic.wire.remove(wire_to_remove) + schematic.wire._elements.remove(wire_to_remove) SchematicManager.save_schematic(schematic, schematic_path) return {"success": True} else: @@ -1984,7 +1984,7 @@ class KiCADInterface: break if label_to_remove: - schematic.label.remove(label_to_remove) + schematic.label._elements.remove(label_to_remove) SchematicManager.save_schematic(schematic, schematic_path) return {"success": True} else: