Skip to content

Instantly share code, notes, and snippets.

@hanya
hanya / README.md
Last active December 29, 2016 16:12
KiCAD macro to add macros executor window to PyShell of Pcbnew

KiCAD macro to add macros executor window to PyShell of Pcbnew

This macro works on Python Shell provided by KiCAD 4.1 or later. 4.0.X can not be supported.

Python Shell is pretty good to execute your line of code provided by Pcbnew. But it is hard to execute long macro many times in the interactive mode. This macro provides way to execute your macros from files stored on your specified directory.

Prepare macros in selected directory and specify it in _KIMACROS variable on Preferences - Configure Paths dialog. Copy content of pyshell_hack.py file into your PyShell_pcbnew_startup.py file which can be found through

@hanya
hanya / README.md
Last active October 6, 2016 13:16
KICAD macro - set text properties on PCBnew

KICAD macro to set text properties on PCBnew

This macro provides way to set text properties on your PCBnew board. You can choose targets by regular expression of the module reference or text string.

Here is the function definition.

def set_text_properties(board, pattern, type="reference", width=None, height=None, thickness=None, visibility=None):
    """ Sets text properties which matches with the pattern. 
 @param board Pcbnew board
@hanya
hanya / README.md
Last active August 23, 2021 02:32
KiCAD macro - generate keepout area in circular polygon

KiCAD macro to draw keepout area in polygon of approximate circle

This macro provides way to add keepout area in polygon of approximate circle on your PCB in KiCAD pcbnew.

If you want to add circle has 3 mm radius at X, Y = 90, 100 position, call insert_keepout function as follows:

insert_keepout(90, 100, 3)
@hanya
hanya / README.md
Last active December 15, 2015 16:38
Macro executor dialog for KiCAD Pcbnew

Macro executor for KiCAD Pcbnew

This macro provides the dialog which allows you to execute your Python macros easily.

How to use

Put the macros.py file in the plugin directory let the file is automatically loaded.

KICAD_PATH/scripting/plugins