Silkscreen with document properties like %D date and %T title

Hello Everyone,

Is there a variable that I can use in the silkscreen layer to display the Date or Title of the document? Similar to the way the template editor works with %D and %T.

Not with 5.1, but v6 will have text replacement variables. New string replacement options for kicad assets

Thanks! That’s worth waiting for.

You can do it now with a SimplePlugin.

There are posts on making SimplePlugin’s.

Including the Date and Time is just a couple of lines of code added to the plugin.

Clicking the Plugin Button/Icon will replace the Place-Holder field with the Current Date and Time (and, naturally, you can do other text/items… and use individual Date and Time fields) Pretty simple.

The Place-Holder field can be put into your default Templates and/or simply added to a PCB anytime…

Example shows Notes on different layers and Date/Time on one layer (because I was too lazy to spend 15 seconds adding to other layers…)

1 Like

There is this plugin which should sort you out.

Generally, there are a lot of plugins available and a good place to start to explore these is this repository.

There was a relatively recent Hackaday piece looking at a few of these.

Man, I think I’ve been living in a hole. I’m so happy someone added the SimplePlugin methodology!!!

1 Like

So I found myself with a little time over the holiday and started playing with the SimplePlugin scripts. It seemed like everything was working well, I was creating plugins, they were showing up in the menu bar. I was switching back and forth between CLI (so I could print at the shell), and the system icon. For reasons I can’t explain, the only plugin that shows up now is the original simple_plugin.py script. It seems like I should be able to put as many scripts in the ~/.kicad_plugins folder as I want, right? Is there a reason the only script that shows up is called simple_plugin.py? I’m guessing one of 2 things, there is a config file that gets generated somewhere that isn’t picking up the other scripts even if I “refresh plugins” OR maybe there is an error in one of the other scripts that kills the process as it loads (I purposely put errors in the simple_plugin.py and it just seems to run the version that worked, so I’m still scratching my head).

Found the magic to see that it is skipping the files with:
pcbnew.NOT_LOADED_WIZARDS
pcbnew.FULL_BACK_TRACE

Good work!

Yes, those two items are posted in response to some trouble I previously had.

I often have a need to move items From various layers To a different layer and made plugins to do it… I now have 10 useful plugins that make my work a bit quicker… Example moves Selected Items to B_Cu…

layerChange.mov

So, I think I’ve got most of this figured out now. This is neat, did you post the code for this anywhere? I need to start digging into the pcbnew module to see how to get and modify various stuff. I’m not really clear yet how the data is structured. Back when Kicad used the BRD file format, I wrote Perl script to parse the files to do things like this. That was really easy to figure out since the file format was published but super limited since you had to save, modify, re-open, and check… I don’t see the same type of documentation for python. Kinda a bummer, but I’m guessing if I just start reading the code, and look at the classes, it will all start to click… I guess I can start with the example code set that is published.

Re: posting code… I have posted some code here and there but find myself subscribing more and more to the philosophy of “Give a man a fish, he eats for a day. Teach him to fish, he eats for a lifetime”

Unfortunately, the documentation is lacking and though this may be useful, I learned more by looking at the Plugin’s that came loaded with Kicad. Each of the dozen or so plugins has some Fish Bait to learn from, so to speak. If he doesn’t want to learn to fish, well, he’s not too hungry…

I made a Boiler-Plate plugin to test small snippets of code… That made it a bit less cumbersome and I keep Python Editor (Idle 2.7.15) and the Plugin open while geeking. I simply Refresh the plugin’s without closing Kicad or PCBnew…

In case you ask - In my opinion, Idle 2.7.15 seems more compatible (than 3.8) with Kicad’s wxwidgets python…

The boiler-plate idea is a good one. I’ve got the simple/complex Plugin stuff figured out now. It’s a simple architecture and easy enough to implement now. Starting to use namespaces to find out how things are connected. It’s not as intuitive as I thought it would be, oh well, I think the same can be said about fishing! I’m assuming you used GetDrawings and IsSelected, and some attribute to set the layer?

@mmccoo took a lot of his time looking at the python API and documenting his findings, unfortunately he doesn’t seem to be active anymore, but he has many interesting post at:

https://kicad.mmccoo.com/
https://github.com/mmccoo/kicad_mmccoo

still useful if a bit dated.

This helped (and answers your question)…

Do your remember the pathname where you found those Plugin’s ?

On my Mac, they’re in:

Applications>Kicad>Kicad_Contents>SharedSupport>scripting>plugins

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.