feat: add angle rotation and mirrorY horizontal flipping for components

- New angle parameter for component rotation (degrees, KiCad CCW-in-screen)
- New mirrorY parameter for horizontal symbol flipping (transistor orientation)
- Property positions (Reference, Value, Footprint) automatically rotated
- Property text effects preserved from library definitions
- Updates to add_schematic_component tool with new parameters
- Implements proper S-expression formatting for (mirror y) attribute
- Text angles and offsets derived from library properties for correct placement
This commit is contained in:
ka ru
2026-05-26 17:30:28 +02:00
parent d765bfec78
commit 5a9790301e
2 changed files with 156 additions and 12 deletions

View File

@@ -55,6 +55,14 @@ export function registerSchematicTools(server: McpServer, callKicadScript: Funct
.min(1)
.optional()
.describe("Unit number for multi-unit symbols (1=A, 2=B, 3=C, …). Defaults to 1."),
angle: z
.number()
.optional()
.describe("Rotation angle in degrees (KiCad CCW). 0=vertical resistor, 90=horizontal. Defaults to 0."),
mirrorY: z
.boolean()
.optional()
.describe("Mirror the symbol horizontally (flip left-right). Useful for transistors facing opposite direction."),
},
async (args: {
schematicPath: string;
@@ -64,6 +72,8 @@ export function registerSchematicTools(server: McpServer, callKicadScript: Funct
footprint?: string;
position?: { x: number; y: number };
unit?: number;
angle?: number;
mirrorY?: boolean;
}) => {
// Transform to what Python backend expects
const [library, symbolName] = args.symbol.includes(":")
@@ -82,6 +92,8 @@ export function registerSchematicTools(server: McpServer, callKicadScript: Funct
x: args.position?.x ?? 0,
y: args.position?.y ?? 0,
unit: args.unit ?? 1,
angle: args.angle ?? 0,
mirrorY: args.mirrorY ?? false,
},
};