Plugins in PCBNEW?

How do I run a plugin in PCBNEW on WIN7???

As scripting is not really under any kind of control, there are a lot of solutions available. For start, KiCad supports footprint wizard plugins and action plugins.

The action plugins support is available only in nightly releases, while the footprint wizards plugins are available also in 4.0.7 (probably also in earlier versions). The plugins extend the KiCad functionality usually with additional GUI elements. The plugins have to be placed in certain folders. On Windows that is usually C:\Program Files\KiCad\share\kicad\scripting\plugins. Once the plugin is put in appropriate location it can be run (the KiCad has to be restarted to rescan the folder for plugins).

The footprint wizard plugins are run in the footprint editor by clicking the “new footprint using the footprint wizard” icon in the top menu. The action plugin is run in pcbnew menu “tools/external plugins”

Additionally there is a support for scripting via scripting console, which you can open in pcbnew. Here you can run any python file and the file can be located anywhere on the system.

Also there are quite a few python modules/packages which can be run without any Kicad/pcbnew.

A lot of these solutions are listed in KiCad Third-Party Tools.

2 Likes

There are also plugins for BOM generation, which for some reason live in a different folder …\KiCad\bin\scripting\plugins. BOM Plugins can be Python or XSLT scripts (maybe other types as well).

They can also be node-js scripts (example) .

As far as i can tell they can use any scripting language as long as the interpreter is installed on the system. (The first argument tells the bom wizard what interpreter to run for the script given in the second argument.)

Hi people,
I’va installed the last Windows Nightly version for running plugins…Now I can see the new “Tools->External Plugins” button, but whenever I try to refresh the plugin list, I cannot see any plugin available (I’ve also tried to restart KiCad several times).
In my “C:\Program Files\KiCad\share\kicad\scripting\plugins” folder I can see several .py files, and I have also added some new ones (downloaded from the GitHub repository), but I cannot see or run these plugins form PcbNew.
Anybody could give me any hint?
Thank you in advance.

Hi,

I ran into the same problem. Here is how I fixed this:

A lot of the examples have dependencies on some python packages. Make sure you have installed them with pip. Then they should start to show up.

Another tip: KiCAD seems to cache the scripts somewhere with the program start, so modifying them live and the “refresh plugins” menu option has no effect for me. I have to restart the whole application.

Thank you for your suggestions, SnowMB.
Please, could you explain me precisely the meaning of this sentence:
“A lot of the examples have dependencies on some python packages. Make sure you have installed them with pip.”
I do not know anything about Python…what (and how) should I install in the KiCad framework for being able to run scripts? I thought that downloading the .py files and placing them in the correct folder could be enough.

Thank you again in advance.

Please, let me submit the question again.
The conditions for launching an action plugin in PcbNew, under Windows 7, seem to be the following ones:

  • Installing a nightly version (5.0.X).
  • Placing the desired .py plugins in the folder “C:\Program Files\KiCad\share\kicad\scripting\plugins” (or maybe, are there any exceptions?).
  • Previously installing some additional Python packages by Pip software?? Possibly, which ones?

Plase, if anybody could solve my doubts, I’d be very grateful.
Thank you in advance.

It’s not recommended to manually add/remove anything in the default installation folder. Use the user configuration folder instead.

Edit: User configuration folder for Windows Vista & later: “C:\Users\username\AppData\Roaming” + kicad\ (= %APPDATA%\kicad)

Thank you Eelik,

I’ve tried to place my plugins both in the folder:
“C:\Users\username\AppData\Roaming\kicad\scripting\plugins”
and in the folder:
“C:\Users\username\AppData\Roaming\kicad\scripting”

but my “Tools->External plugins” command still does not work (cannot see any plugin listed).

I guess there’s something else missing in my framework…maybe Python packages??

Exactly which plugin are you are trying to install? There are several types of “plugin”, only “Action plugins” are supported on Tools->External Plugins.

These ones:

I’m trying to follow this example:

By exactly, I mean the name of the script file. There are many files there, I am not going to test all of them.

In the video, there is about one frame showing how to run the script https://youtu.be/av5HwAFl2VI?t=344. I’m not sure why that is quickly skipped over when everything else is explained in excruciating detail.

Anyway, to run the script you need to open the Python console in pcbnew, then type execfile('/path/to/file.py') in the command window. Since you haven’t said which script I can’t be more specific.

Sorry, Bobc.
The exact topic I was going to follow, is this one (that completes the previous one):

In the enclosed video, it is clearly shown that the author uses the function “Tools->External Plugins” for running his scripts (the ones of the GitHub repository “dxf_stuff”).

Certainly some of them are Action plugins, but not all of them.

So final time, which script do want to run?

If you say “all of them”, you will have to learn some scripting and go through each one and figure it out yourself, since the publisher did not provide much in the way of installation instructions.

1 Like

From what I’ve seen mmccoo’s plugin require additional modules. And as you’ve already figured this out:

  • you can’t install this packages in python that is packaged with KiCad
  • you can’t really use pcbnew module with python3

What you might try is install python2.7 and import pcbnew module to this python. Look up on google how to import modules from absolute path. I had some luck with this kind of setup a year ago, but now I am just using KiCad’s python only as it is way more portable.

Thank you all for your answers,
My trouble was thinking that dealing with KiCad 5.0 and the use of scripting was available to anybody…but it is not so.
I guess that not-skilled users should not try to use this kind of devices, and keep using KiCad 4. You have to be able to deal with Python and scripting for managing these powerful tools…otherwise, it’s better to keep using “easy” tools.

Now I’ll try to move to Eagle, for checking if it more suitable for my needs (circular layout).

Thank you all for your support.

Bye

Scripting always requires background knowledge. In every tool.

In your other thread i pointed you to an explanation how your requirements can be done using the kicad internal array tools. By your answer i guess you never read that.


Regarding scripting: KiCad does not support all scripting tools on all platforms.

You also did not answer some question from the guys trying to help you. (Is it really that hard to clarify which exact script you try to run?) So i would guess you already made up your mind that the golden eagle is better for you and just wanted conformation.

Ok, you are right.
The problem is that, as shown in the picture I uploaded, the author uses several functions for modifying his schematic. Now, if I look at the folder “dxf_stuff” he has uploaded, it contains several plugins, whose names are completely different from the functions he uses in his video; for example:

  • dxf_plugins.py
  • dxf_to_graphic.py
  • dxf_utils.py
    So, how can I know exactly which plugin I need for the functions used in the video? Essentially, all the functions listed in my image where used by the author for his work, but I do not know where these functions have been placed in terms of plugins.
    Thank you.

If you are that focused on using exactly the workflow shown in the video, maybe try to comment on the video and contact the author that way?

We do not really know more about that particular video than you do. (Form the title i would assume this is not a tutorial but just a showcase of all his plugins. The author also mentioned that they intent to create a more detailed post later on. Maybe you can find that.)