KiCad Plugin With Python
Contents
Preparation
โ Install KiCad โ Python & wxPython knowledge
Quick Start
โฆฟ Create a blank project โท Open "PCB Editor" โท Click "Show the Python scripting console".

โฆฟ Enter the following command at "2".
>>> import wx โฉ๏ธ
>>> wx.MessageBox("Hello World") โฉ๏ธ

Create A Hello World Plugin
โฆฟ Create a Hello_World.py file. โฆฟ Enter the following code.
import pcbnew
import os
import wx
class SimplePlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Hello World"
self.category = "A descriptive category name"
self.description = "A description of the plugin and what it does"
self.show_toolbar_button = False # Optional, defaults to False
def Run(self):
# The entry function of the plugin that is executed on user action
wx.MessageBox("Hello World")
SimplePlugin().register() # Instantiate and register to Pcbnew
โฆฟ put it in:
Windows: ...\Documents\KiCad\6.0\scripting\plugins\
MacOS: .../Documents/KiCad/6.0/scripting/plugins/
โฆฟ Open PCB Editor โท Tools โท External Plugins โท Hello World

Show "Hello World" OK โฉ๏ธ










