Article 006- Adding new commands to KiCad's PCB Editor
- Details
- Published: Wednesday, 22 July 2026
- Hits: 146
Adding new commands to KiCad's PCB Editor
As a long-time AutoCAD user, I often find working with other CAD packages frustrating. AutoCAD has been refined over several decades by Autodesk, resulting in an extremely efficient and intuitive workflow that experienced users quickly become accustomed to. It is not simply a matter of unfamiliarity with KiCad's commands; rather, coming from an AutoCAD background, some aspects of KiCad's workflow can be surprisingly cumbersome and inefficient.
While using KiCad for PCB design, I frequently found myself missing certain AutoCAD-style commands and workflows. To be fair, KiCad often provides equivalent functionality, but it is not always implemented in the same way, nor is it always as efficient or intuitive for users accustomed to AutoCAD.
With that in mind, I downloaded the latest KiCad source code and successfully imported the project into Visual Studio 2022, allowing me to explore and modify the C++ codebase directly.
This article will evolve as the project progresses. My intention is not only to implement improvements that benefit my own workflow, but also to investigate the process of submitting suitable enhancements to the KiCad development team for consideration in future releases. In the meantime my updates are on my GitHub - https://github.com/Ian-Johnston/KiCad-modifications
Getting the source code installed in Visual Studio 2022:
This involved considerably more than simply opening the source code. As KiCad is a large C++ application that uses CMake and a substantial number of third-party libraries, the process began by downloading the source code, opening the root folder directly in Visual Studio's CMake environment, and configuring the build system.
A separate vcpkg package manager installation was required to automatically download and build over a hundred dependencies, including wxWidgets, Boost, OpenCascade and numerous supporting libraries.
Several issues had to be resolved along the way, including modifying the CMake preset configuration and diagnosing a build failure caused by an obsolete tar.exe from an Atmel development package being incorrectly detected and cached by CMake.
Once these issues were resolved, KiCad successfully configured, compiled and linked, producing a working debug build that could be launched directly from the generated installation directory. The entire process provided a fully functional Visual Studio development environment suitable for debugging and modifying the KiCad source code.
After Visual Studio/Ninja has compiled all the source code and created the executables and DLLs in the build tree, this command which copies all of the required runtime files into a structured installation directory:
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --install build\msvc-win64-debug
This includes the KiCad executables, internal DLLs, plugins, scripting files, libraries, icons, translations and other runtime resources. This has tto be run after every build in VS2022.
UPDATE 24/07/26:
Sadly, I found complying with KiCad's MR (Merge Request) too much for me so won't be submitting my code to the team. I did try installing GitLab & GIT, then did a COMMIT and an MR, but it failed due to mostly code formatting errors. I'm not entirely sure if VS2022 is causing these but certainly some are self inflicted as I think it's quite strict. From what I can see I'd need to run diffs from the command line to check as I fixed them. I'm tired of command line........it's 2026!
No offence to KiCad, it's just not for me........so my KiCad code mods stay with me for my own use. However, if you are an existing KiCad developer and want to take them on then contact me.
Here's where I got to:
AutoCad style commands
MATCHPROP
Copies properties from one entity to other similar entities, such as tracks to tracks or vias to vias.
The user selects a source track or via, invokes the command using SHIFT+Q, and then simply clicks on target tracks or vias one after another. The selected properties are immediately applied to each target entity. The command remains active until ESC is pressed. Also supports drag selecting a bunch of tracks or vias.
MATCHPROP is also available from the right-click context menu when a supported entity is selected.
Note: This command can be used by selecting the via/track then invoking the command, or, selecting the command then applying it to the track.
EXTEND & TRIM
Extend - Extends an existing straight track until it reaches the nearest suitable boundary in the selected direction.
The user invokes the command using SHIFT+E, then clicks near the end of the track to be extended. The endpoint nearest the cursor is extended along the existing track direction until it meets either a same-net track on the same copper layer or a straight graphic line being used as a temporary boundary.
The command remains active, allowing additional tracks to be extended one after another until ESC is pressed.
EXTEND is also available from the right-click context menu when a straight track is selected. When invoked from the context menu, the selected track is extended immediately without requiring it to be selected again.
Note: This command can be used by selecting the track then invoking the command, or, selecting the command then applying it to the track.
Trim - Shortens an existing straight track back to the nearest suitable boundary.
The user invokes the command using SHIFT+T, then clicks on the portion or end of the track that is to be removed. The endpoint nearest the cursor is moved back to the nearest intersecting same-net track on the same copper layer or to a straight graphic line being used as a temporary cutting boundary.
If the selected track passes through two boundaries, TRIM can also remove the section between them, leaving the remaining track terminated at the appropriate intersection point. This allows unwanted track segments to be quickly removed without manually editing endpoints.
The command remains active, allowing additional tracks to be trimmed one after another until ESC is pressed.
TRIM is also available from the right-click context menu when a straight track is selected. When invoked from the context menu, the selected track is trimmed immediately without requiring it to be selected again.
Note: This command can be used by selecting the track then invoking the command, or, selecting the command then applying it to the track.
.....future commands?
MOVEFROM
The user selects one or more items, invokes the command, picks any reference point on the selection, then picks a destination point. The selection is moved such that the chosen reference point lands exactly on the destination point.
COPYFROM
The user selects one or more items, invokes the command, picks any reference point on the selection, then picks a destination point. A copy of the selection is created with the chosen reference point landing exactly on the destination point. The command remains active until ESC is pressed.
OFFSET
The user selects a line, arc, board outline or graphic object, invokes the command, enters an offset distance and then clicks the side to offset. A new parallel object is created at the specified distance.
BREAK
The user selects a line, track or arc, invokes the command and then picks two points. The section between the two points is removed.
JOIN
The user selects two or more connected lines, arcs or tracks and invokes the command. The selected geometry is merged into a continuous object where possible.
STRETCH
The user selects geometry using a crossing window, invokes the command and drags a reference point. Only vertices within the crossing selection move while connected geometry stretches to maintain continuity.
ALIGN
The user selects multiple objects, invokes the command and chooses Left, Right, Top, Bottom, Centre Horizontal or Centre Vertical. The selected objects are aligned accordingly.

