PCB Generator?

Does a “PCB Generator” type plugin exist for Kicad? This would let you quickly create PCBs in the PCB Editor through a dialogue box with options like dimensions, ground planes, mounting holes, graphics etc.

I want to port over some scripts I use in Eagle to generate PCBs, but if someone has already done this it might be better if I contribute instead of starting from scratch. I couldn’t find anything though…

My script also generates a “Sick of Beige” style case for the PCB that can be exported as a DXF to the lasercutter. It would be cool if the case and PCB can be shown assembled in the 3D viewer. Possible?

I am not aware of a script like that, but I also never looked. KiCad is becoming quite popular, and there are > 100 side projects around KiCad, and such a thing may exist.

I am also not sure how useful a thing like that is. If it’s something simple, then it’s also trivial to just draw a rectangle for the PCB for a new project. If it becomes more complete, it also becomes more specialized and less universal.

KiCad itself has another approach. Any project can be saved into the “template” directory, and can then be reused to start a new project. The amount of work for such a template is minimal. You need to add a description, and a picture that can be used as an icon to click on.

I am sure that in the past I have seen a PCB script which at least draws an outline, and I think I actually wrote a script to do it. I can’t find it now.

There are definitely scripts which place footprints and tracks. Unfortunately documentation for PCB scripting is lacking, and because the API is a moving target, any examples tend to go stale quickly.

There have also been some attempts to create abstracted Python APIs which are more independent of the Kicad interface, but these have mainly been for symbols and footprints. They have the same problem of moving API, plus lack of resource in maintaining the Python libraries.

I also recall someone created a new scripting language which was supposedly “easy to use” but that may have been only for the author.

tldr; lot of effort, little demand, go for it.

This is interesting or I don’t get it. “This would let you quickly create PCBs in the PCB Editor” this is exactly what Kicad does and was design to do, but you suggest taking it a step further and have you type in some parameters? and I don’t get how you would enter ‘ground planes’ ‘mounting holes’ and stuff as these appear to me during my design process also things change as problems that need to be sussed out occur. I agree with @paulvdh that you can have templates and thats great but what you suggest seems like some level of mind reading here would be needed. Regarding the case, the relationship between Kicad and Freecad grows stronger with every release and that is probably the best and easiest way to go. I will certainly keep my eyes open and if something like this happens my sure it will be fascinating :nerd_face:
:mouse:

1 Like

Thanks guys.

The main point of using scripts is to reduce errors. Once you figure something out, make a script for it and it will be reliable until the software package changes enough to break it. That’s a large chunk of work that you don’t even need to think about anymore, leaving you more time to think about more important things than stuff you’ve already though about.

It’s also more efficient if you’re doing a bunch similar things – like making PCBs, all of which have a different size but the same features such as mounting holes, graphics, etc. If you’re making one PCB every now and then this it doesn’t make much sense to make a script out of it, but if you’re making new PCBs every day then it’s a massive time/money saver.

Further, if you’re designing 2D CAD stuff like front panels or cases for lasercutting, having those objects on the drawing means all the holes you need to cut out for pots, switches, jacks, etc. will line up automatically. All you need to do is export those layers as DXF or whatever. I also put the laser cutouts on parts in a custom parts library so that when you add the part to the board the cutout is automatically put on the right layer. This saves at least an hour from drawing the panel from scratch in Inkscape (assuming no mistakes – but there’s going to be lots!), but this generated panel will be 100% correct before I even start working on it – and I didn’t do any “work” to get it. It’s just there, like magic.

I have just over a dozen scripts on Eagle (which is very automatable) to automate my workflow all the way from the schematic to generating files for the PNP machine. It’s pretty much eliminated dumb errors as well as speeding everything along. It looks like the same can be done with Kicad, and possibly more.

Sorry for the wall of text. I’m pretty enthused about automation, ha ha.

2 Likes

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