refactor: move move_schematic_component registration back to original position
Restore the tool registration order so move_schematic_component appears before rotate_schematic_component, matching the pre-PR location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -717,6 +717,56 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Move a placed symbol, dragging connected wires
|
||||||
|
server.tool(
|
||||||
|
"move_schematic_component",
|
||||||
|
"Move a placed symbol to a new position in the schematic. By default (preserveWires=true) wire endpoints touching the component's pins are stretched to follow the new position.",
|
||||||
|
{
|
||||||
|
schematicPath: z.string().describe("Path to the .kicad_sch file"),
|
||||||
|
reference: z.string().describe("Reference designator (e.g., R1, U1)"),
|
||||||
|
position: z
|
||||||
|
.object({ x: z.number(), y: z.number() })
|
||||||
|
.describe("New position in schematic mm coordinates"),
|
||||||
|
preserveWires: z
|
||||||
|
.boolean()
|
||||||
|
.optional()
|
||||||
|
.describe("Stretch connected wire endpoints to follow the move (default true)"),
|
||||||
|
},
|
||||||
|
async (args: {
|
||||||
|
schematicPath: string;
|
||||||
|
reference: string;
|
||||||
|
position: { x: number; y: number };
|
||||||
|
preserveWires?: boolean;
|
||||||
|
}) => {
|
||||||
|
const result = await callKicadScript("move_schematic_component", args);
|
||||||
|
if (result.success) {
|
||||||
|
const moved = result.wiresMoved ?? 0;
|
||||||
|
const removed = result.wiresRemoved ?? 0;
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text:
|
||||||
|
`Moved ${args.reference} from (${result.oldPosition.x}, ${result.oldPosition.y}) ` +
|
||||||
|
`to (${result.newPosition.x}, ${result.newPosition.y})` +
|
||||||
|
(moved > 0 ? `, ${moved} wire endpoint(s) updated` : "") +
|
||||||
|
(removed > 0 ? `, ${removed} zero-length wire(s) removed` : ""),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `Failed to move component: ${result.message || "Unknown error"}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
isError: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Rotate schematic component
|
// Rotate schematic component
|
||||||
server.tool(
|
server.tool(
|
||||||
"rotate_schematic_component",
|
"rotate_schematic_component",
|
||||||
@@ -1082,56 +1132,6 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// Move a placed symbol, dragging connected wires
|
|
||||||
server.tool(
|
|
||||||
"move_schematic_component",
|
|
||||||
"Move a placed symbol to a new position in the schematic. By default (preserveWires=true) wire endpoints touching the component's pins are stretched to follow the new position.",
|
|
||||||
{
|
|
||||||
schematicPath: z.string().describe("Path to the .kicad_sch file"),
|
|
||||||
reference: z.string().describe("Reference designator (e.g., R1, U1)"),
|
|
||||||
position: z
|
|
||||||
.object({ x: z.number(), y: z.number() })
|
|
||||||
.describe("New position in schematic mm coordinates"),
|
|
||||||
preserveWires: z
|
|
||||||
.boolean()
|
|
||||||
.optional()
|
|
||||||
.describe("Stretch connected wire endpoints to follow the move (default true)"),
|
|
||||||
},
|
|
||||||
async (args: {
|
|
||||||
schematicPath: string;
|
|
||||||
reference: string;
|
|
||||||
position: { x: number; y: number };
|
|
||||||
preserveWires?: boolean;
|
|
||||||
}) => {
|
|
||||||
const result = await callKicadScript("move_schematic_component", args);
|
|
||||||
if (result.success) {
|
|
||||||
const moved = result.wiresMoved ?? 0;
|
|
||||||
const removed = result.wiresRemoved ?? 0;
|
|
||||||
return {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text:
|
|
||||||
`Moved ${args.reference} from (${result.oldPosition.x}, ${result.oldPosition.y}) ` +
|
|
||||||
`to (${result.newPosition.x}, ${result.newPosition.y})` +
|
|
||||||
(moved > 0 ? `, ${moved} wire endpoint(s) updated` : "") +
|
|
||||||
(removed > 0 ? `, ${removed} zero-length wire(s) removed` : ""),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: `Failed to move component: ${result.message || "Unknown error"}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isError: true,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Sync schematic to PCB board (equivalent to KiCAD F8 / "Update PCB from Schematic")
|
// Sync schematic to PCB board (equivalent to KiCAD F8 / "Update PCB from Schematic")
|
||||||
server.tool(
|
server.tool(
|
||||||
"sync_schematic_to_board",
|
"sync_schematic_to_board",
|
||||||
|
|||||||
Reference in New Issue
Block a user