PcbDraw v1.0 Released — What’s New?

Share via

PcbDraw is a tool that allows you to create beautiful drawings of your PCBs designed in KiCAD. Today, we released version 1.0 of the tool. What’s new?

example

A little bit of history

PcbDraw was created during a single-night coding session on  Apr 13, 2017, to address my need to have nice drawings of my PCB that I use for documentation and promotion. It works by disassembling the SVG files produced by KiCAD, transforming them, and assembling them such that they form a nice diagram.

Back then, the whole tool started as a small, single-purpose script. However, once it got users, more and more functionality was glued in, the complexity increased the code quality meanwhile steadily decreased. We also relied on ImageMagick for file format conversions. ImageMagick is hard to configure and easy to misconfigure, so we often received bug reports showing that the conversions aren’t working properly.

Even PcbDraw can generate nice drawings; it requires you to have hand-draw footprint libraries. And let’s be honest, this is a high threshold for many users. Most of them would be completely happy with 3D rendering.

To address these needs, I started rewriting the PcbDraw basically from scratch, just preserving the original philosophy.

What’s new?

Under the hood, most of the code is rewritten. I wanted to improve code quality and also to allow PcbDraw to be used by other projects, and have a highly customizable rendering process. Therefore, we present an API that you can use in other projects to render boards.

The API is built around the PcbPlotter class. You can configure it, assign a layer plotting plan and execute it. Everything is now captured inside this object, no global variables, no IO leaks outside, and predictable library lookup. Therefore you can easily use it in your projects and, most importantly, customize the plotting process. Do you want to skip silkscreen? You can. Do you want to plot a documentation layer? You can.

We also abandoned ImageMagic. Instead, we implement the conversion strategies by ourselves. It leads to predictable behavior, and from the tests so far, it is more reliable and less headache to debug if something goes wrong.

Lastly, we implemented the experimental support to capture a 3D rendered view of the board. This feature is, however, available only on Linux, and it is very slow. Unfortunately, KiCAD has no API for controlling the 3D renderer, and it seems there won’t be any anytime soon. Therefore, we launch KiCAD in a virtual screen and send keystrokes to it. This process is very fragile, and there is a risk it will break often. But since there was a huge demand for this functionality, I guess it is worth it.

Therefore, Pcbdraw now has two subcommands: pcbdraw plot and pcbdraw render. The first one creates a drawn diagram, and the second one captures the rendered. We support both traditional 3D render and the raytracer. We also allow you to customize projection, select a side, or make a transparent background.

There are also a couple of small features added, such that improved component highlighting, a reworked algorithm for reconstructing board substrate from the SVG image, and the support for drawing resistor bands based on their value (which was implemented by Electro707).

A little bit of the future

Unfortunately, there is one thing that I miss in the current version to consider PcbDraw as complete. That is a new tool for library management and revisited footprint library that would be compatible with the current KiCAD footprint library. However, this task will be time-consuming, and I already think that people can benefit from the new features of PcbDraw. Therefore, I decided to release v1 even though we still lack a proper hand-drawn library. The other reason for releasing v1 early is also that my other tool, Pinion and KiKit, can already leverage the new functionality of PcbDraw, and I would like to allow the users already use updated versions of these tools.

Acknowledgments

Having all these new features & bug fixes wouldn’t be possible without the support of my Github Sponsors. Your support allows me to allocate more time to maintain my open-source projects. I really appreciate your trust in me.

And I also would like to thank my one-time donators on Ko-fi and all the users that submitted a PR or properly reported bugs such that it was easy for me to reproduce the bugs and fix them.

Support my work!

If you like my work (these blog posts, my software and CAD models) and you would like to see more posts on various topics coming, consider supporting me in various ways:

If you are interested in knowing what I am up to and recent sneak-peaks, consider following me on social media (Twitter, Instagram, Facebook).

My store offers

I launched new tank cleaning kits for Elegoo Saturn, Saturn S, Mars 1, and Mars 3. You can find them in my store.

Share via
Back To Top