How to run kicad-action-plugins on KiCad 5.99?

Hello,

I’m looking to run the layout replicator from here: https://github.com/MitjaNemec/Kicad_action_plugins/tree/5.99_test

on latest version 18/2/2021
but when I come to run it it show me this error:

image

which I guess has something to do with the fact that I’m running the latest version of kicad 5.99 but the author says

With 5.99 the plugins might or might not work. With 5.99 versions from Apr 7, 2020 the plugins might not work, as the schematics format changed and some plugins parse, or even change the schematic file.

but I’m not sure where can a copy from before April 7,2020 can be obtained…

Does anyone has an advice on how this can be managed?

Thanks for your time! :smiley:

There is no point trying to get older kicad version, it won’t be able to open your project.
Instead wait for @MitjaN to finish his work on porting this plugin to 5.99. Your particular issue likely has a simple fix (check that “pcbnew” is substring of window title instead of it’s prefix because title format changed).

Um ok but where do I check is what is it related to?

@MitjaNn mentions

You need to have KICAD_SCRIPTING_WXPYTHON enabled. They should also work on GNU/Linux distributions and MacOS even with Python3.

What is that KICAD_SCRIPTING_WXPYTHON as well?

Is that enabled by default?

You need to have KICAD_SCRIPTING_WXPYTHON enabled

This means that your build of KiCad needs to have configuration variable KICAD_SCRIPTING_WXPYTHON enabled during compilation time. On all builds of 5.99 that you can get from official sources it is enabled so you don’t have to worry about it.

Not sure what you mean.

If you are not a developer there isn’t much you can do right now. Some plugins that were written for 5.1 will not work in 5.99 without some adaptations and it’s up to plugin authors/maintainers to do that.
If you know python then you can fix the plugin yourself and maybe contribute the fix upstream.

Well I’m just looking for a quick fix for this currently, and looking into the script it seems like it has around 1120lines just for the main file and I’m trying to look for the relavent api’s for the latest kicad 5.99 and it’s al over the placed mixed with the api of the older version so I’m not sure even where to start…

I don’t know anything about this particular plugin, but in general I don’t think it’s reasonable to expect Python plugins to work with nightly builds. We don’t have a stable Python API yet, and until we do (and plugin authors re-write their plugins to use the stable API) I don’t think it’s fair to expect them to keep up with nightly build API changes.

2 Likes

The error in your screenshot tells you exactly where the problem is, it’s in action_replicate_layout.py line 318

The other clue I already wrote above

so instead of

_pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTile().lower().startswith('pcbnew')][0]

try

_pcbnew_frame = [x for x in wx.GetTopLevelWindows() if 'pcbnew' in x.GetTile().lower()][0]

This may be not the only issue but it should at least move you forward.

image

same same new name.

Yeah but the author @MitjaN mentions in the github page that it was compatible to kicad 5.99(which is still nighly) that it is working for the available nightly kicad versions from april, 7 2020
I was hoping to find a version from around that time to run the script.

You didn’t restart kicad after changing plugin code. Also I have a typo there, xGetTile() should be x.GetTitle()

Yeah you are right looks like I’m going to have to sit on it for a while…

May I have a hint of where I can find the most relevant API and fix the whole repository while I’m on it?

https://docs.kicad.org/doxygen-python/namespacepcbnew.html

A hint for your current error: you can expect anything that says “modules” to have been changed to “footprints”

Regarding documentation look at this post.

As for the plugin, I don’t know when you were on gitHub landing page, but for two weeks now there is a 5.99 version for Replicate_layout plugin available in dedicated branch (mentioned in 3rd paragraph). It might work but I have not received any positive feedback yet. If it does not work, raise an issue.

But for a proper V6 version of the plugin you’ll have to wait a while. I’ll start to migrate them once situation around eeschema Python API and plugin/content manager is clear.

@qu1ck, any news regarding the plugin/content manager?

Thank you very much took a glaze at it and as it is such an unstable time to just begin develop for kicad as the idea is still forming I think staring at it for hours won’t help without a little bit of documentation but that’s a start.

and well I’ve downloaded the newer version from here and running today’s kicad nightly version and this doesn’t seem to run smoothly(never tried your tools but they seem like what I’ve wanted from kicad all there years.) so I’m trying to patch it to perform a duplicate operation on a PCB I’M working on, but with no luck. now I’m working on this line:

but even the method GetFootprints() pop an error says it need 4 arguments only one was provided and can’t find a clue for that in the API docs

BTW don’t grab components and hit escape it’ll crash kicad

You should use Footprints instead of GetFootprints.

But As said, if you raise an issue on Github, or continue this one I can integrate the changes and someone else besides you will benefit from this

Thanks sure thing I’m still trying to get the hang of all this collaborative programming on github sins I’m still trying to bring my coding skills to a more serious level coming from the C embedded programming world.

I’ll start taking care of this tomorrow.

Implementation in progress. Once it’s merged and repositories are setup I’ll ping you and some popular plugin writers to help with onboarding.

4 Likes

I was hacking this plugin to work for me and got it into (somewhat) working shape that was enough for me at the time. Are you sure you have checked out the 5.99 related branch and not the master one?

In 5.99 branch there is a fix for this particular problem:

        _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().endswith('pcbnew')][0]

Realized I wasn’t running the plugin of the the “5.99_kicad” branch running it on today’s nightly version and the one from the 11/2/2021 but none work and the following error message that is not that helpful now:

I think I’ll just wait for kicad to become a little more stable or until I’m more familiar and involved with the developers and the idea behind the development process right now I don’t feel much useful as I’m not an expert in python & C++ yet and I’d guess mentoring towards it for kicad is more hassle than reward so I’ll just wait a little.

look for the replicate_layout_error.log which should be in the folder where the plugin is located and attach it here.

The error message should be changed. It was written 2 years ago when Ubuntu switched to GTK3 while still packaging wxpython build against GTK2, thus KiCad had Wxpython disabled. So most of the errors when registering plugin were due to lack of wxpython support. This is not true anymore.