From f3078b7a02562bbab8cef059d1c9c6e9c2e8c54e Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Mar 2026 20:51:52 +0100 Subject: [PATCH] fix: B.Cu footprint Flip() in SWIG path + J2-on-B.Cu prompt note + pin-1-at-top schema hint --- python/commands/component.py | 13 +++++++++---- python/schemas/tool_schemas.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/python/commands/component.py b/python/commands/component.py index 9489060..bda0b40 100644 --- a/python/commands/component.py +++ b/python/commands/component.py @@ -125,10 +125,15 @@ class ComponentCommands: angle = pcbnew.EDA_ANGLE(rotation, pcbnew.DEGREES_T) module.SetOrientation(angle) - # Set layer - layer_id = self.board.GetLayerID(layer) - if layer_id >= 0: - module.SetLayer(layer_id) + # Set layer — for B.Cu the footprint must be flipped (mirrored), + # not just layer-assigned. Flip() handles layer + mirror in one step. + if layer == "B.Cu": + if not module.IsFlipped(): + module.Flip(module.GetPosition(), False) + else: + layer_id = self.board.GetLayerID(layer) + if layer_id >= 0: + module.SetLayer(layer_id) # Add to board self.board.Add(module) diff --git a/python/schemas/tool_schemas.py b/python/schemas/tool_schemas.py index 16d6e37..dffe3d7 100644 --- a/python/schemas/tool_schemas.py +++ b/python/schemas/tool_schemas.py @@ -1561,7 +1561,7 @@ SCHEMATIC_TOOLS = [ { "name": "connect_passthrough", "title": "Connect Passthrough (Pin-to-Pin)", - "description": "Connects all pins of a source connector to the matching pins of a target connector using shared net labels. Ideal for passthrough adapters where J1 pin N connects directly to J2 pin N. Each pair gets a net label '{netPrefix}_{pinNumber}'. Use this instead of calling connect_to_net 15 times for FFC/ribbon cable passthroughs.", + "description": "Connects all pins of a source connector to the matching pins of a target connector using shared net labels. Ideal for passthrough adapters where J1 pin N connects directly to J2 pin N. Each pair gets a net label '{netPrefix}_{pinNumber}'. Use this instead of calling connect_to_net 15 times for FFC/ribbon cable passthroughs. NOTE: KiCAD Connector_Generic symbols always have pin 1 at the TOP of the symbol and pin N at the BOTTOM. When assigning named nets (e.g. GND, CAM_SCL) to specific pin numbers, always use the physical pin number as shown in the connector datasheet — pin 1 = top of symbol.", "inputSchema": { "type": "object", "properties": {