Current "scripting reference" for beginners?

is there a current equivalent to “KiCad Scripting Reference” kicad-doc/src/pcbnew/pcbnew_python_scripting.adoc at master · KiCad/kicad-doc · GitHub ?

I’m looking for an easy entry point like in this document e.g. iterating through the elements of a board.

I tried to run the “Board Inspection Example” from the link above, but

for item in pcb.GetTracks():
    if type(item) is VIA:

failed with “NameError: name ‘VIA’ is not defined”

Not really. Most of the “for beginners” stuff (both in the docs and third-party things like forum/blog posts) was written a while ago and has not been kept up-to-date with SWIG binding changes.

Your link is to an archived repository (we use GitLab, not GitHub). The current documentation is live on the web here: PCB Editor | 8.0 | English | Documentation | KiCad

The auto-generated class reference is here: KiCad Pcbnew Python Scripting: Namespace List

Yes, I found the current documentation but no easy to follow starting point as in the old GitHub pare cited above.

I wanted to duplicate the function of an Eagle ULP “gen-stop-mask-via.ulp” iterating over all vias of a board and generating solder mask circles with a diameter drill-size plus some addition.

You should be able to use old documentation to get a sense of the way the Python code should be written. Generally what has changed is the naming of things (and sometimes what arguments a function takes). So, if you take the structure of an old example and use the class reference to look at the new names, you can adapt it.

It might also be helpful to look at the source code for some plugins that work with modern KiCad to see what they are doing.

I’ve written several Plugins and found that for ‘me’ I can accomplish what I want to do by simply doing it with Python rather than with Kicad’s stuff. Then, can implement it into a Kicad Plugin…

First: Make a PCB with One Via. Edit-The Via (Open the Properties Panel or, Expand the Properties in PCB (but, you won’t see a Radius there) and also Look at the PCB-File in Text-Editor to understand the Syntax relationship between them.

Second: Manually Add some distance

Third: Implement that knowledge into Python-Code

Fourth: Implement the Python-Code into a Plugin

Example shows a Via with Large Circle in Mask-Layer.
Prop’s Panel shows it’s Radius.
The Center-Point is 213.36mm and has Radius of 2.54.

Know knowing 213.36 + 2.54 = 215.9, you see that result in the PCB’s Text-File (and, in the Expanded PCB Prop’s Panel).

Thus, if you know the Via Diam, you can Add/Change whatever values, and do it in Python. So, naturally you could use Wildcard in searching for Start-Values and Add to them to get desired End-Values.

Example shows doing this using Python Search&Replace (in an App I wrote). Of course you can do this with any Text-Editor, too.

The current version of the old gitHUB page you cited is here in the current documentation:

That contains the examples from the page you cited, but updated for version 8. (They at least worked when 8.0.0 was released, I have not checked that they still work in 8.0.7, but they should)

Plugin howtos · Wiki · eelik-kicad / KiCad Documentation · GitLab may help, it has a loop for finding vias. I have tried to make that article up to date although I’m not sure if everything works in v8.

Thanks - I should have found that out myself!

With this starting point, it seems to be easy to iterate over all vias and add some circles in the mask layers.

I Wounder how backward compatible it would be. I have script used in 4.0 and now not sure I should keep stay there to work additional work on my project or jump to 8.0 (lovely improvements by the way - I love this forum community).
It is a bit scary to use nightly version because it so not forgiving to load with older version like the old days…. Be carefully and plan for long run of your project, and scripting. And it much harder to correct compare to an old format before kicad move to s-parameter style thing… that require a much complex than just regex like the old day with VIM.

The current Python scripting system is not backwards/forwards compatible. Scripts normally need to have minor modifications to work with a newer version of KiCad than the one they were written for.