Kicad-cli: export svg/pdf - no hole in THT pad

Hello everyone,

I have been an enthusiastic KiCad user for a few months now and am currently using version 8.0.6.
I have created a script for generating production data, which automatically generates the circuit diagram, pick-and-place files, STEP files etc…
Now I would also like to create a simple plan of the board, which consists of the layers Edge.Cuts, F.Silkscreen, F.Paste (for the SMD pads) and of course THT solder pads.
And that’s the problem: regardless of whether I export to SVG or PDF, the solder pads are always completely filled in black.
Even if I create my own color scheme and pass it using --theme, I can’t get THT pads that are white in the middle.
I know that it works if you plot the layer from KiCad GUI and don’t export it, but I want to do this script-controlled and not by mouse click (and above all I don’t want to do everything again after a small change).
The current CLI call looks like this:

kicad-cli \
	pcb export svg \
	--output output.svg \
	--layers F.Silkscreen,F.Mask,F.Paste,Edge.Cuts \
	--page-size-mode 2 \
	--drill-shape-opt 2 \
	--black-and-white \
	"$PN".kicad_pcb

So this is how it looks like in KiCad GUI (left side) and when it has been exported (right side):

Does anyone have any idea how I can solve this problem or would this be new?
Unfortunately, the F.Pads layer no longer exists.

Many thanks and best regards
David

I’m not sure why there’s a difference between KiCad Plot from the GUI and the Kicad CLI Export. But you could try Board2Pdf CLI and see how you like that. There you can specify a lot more things.

If you only want one layer for each page you can create a template for each layer. If you want each layer in its own file, you can uncheck the “delete single page files” checkbox.

There was another thread where it turned out that the GUI and CLI executables were from different KiCad versions. I hope this is not the case for you.

I have a small tool called KiExport here - GitHub - vishnumaiea/KiExport: Tool to export manufacturing files from KiCad PCB projects.. I added SVG support to it yesterday. It relies on the KiCad CLI. I am able to generate the SVGs correctly without any issues. Are you sure you are using a proper theme for the export?

I am quite happy with GitHub - INTI-CMNB/KiBot: KiCad automation utility

I know that it works if you plot the layer from KiCad GUI and don’t export it, but I want to do this script-controlled and not by mouse click

Kibot has this thing called “KiAuto” which automates GUI actions:

the easiest way to start using Kibot is inside a gitlab/github runner running a prebuilt docker container (as installing all dependencies manually is a nightmare…).

I made a couple months ago an example for an assembly plan with a gitlab runner:

for github you find an example project here GitHub - INTI-CMNB/kibot_variants_arduprog_site: Example of KiBot navigate results deployment using --quick-start

Is this as simple as the fact that, from the copper layer perspective, the pad IS completely filled in: during manufacture, a hole is then drilled in that pad, and plated. This is backed up by the fact that if you look at the gerbers for the front / back copper layers, there is no hole in the pads.

Whilst perhaps the GUI is actually displaying a “pad with hole”… so two parts (the pad plus the hole) as one? When you look at a “pad” in Kicad PCB editor, there is actually a LOT of information there as well as the details for the “pad” itself… such as the hole size, which layers the pad object should be present on, clearances, the net it is connected to.

Hi retiredfeline,

Thank you for mentioning that - I checked the versions of kicad-cli and kicad and they do match (both version 8.0.6)

Hello albin,

thanks for the suggestion. As I see it, your tool unfortunately has the same problems as mine when it comes to displaying the hole in pads in transparent or white. So it doesn’t solve my problem. But it is still interesting.

Regards
David

Hello vishnumaiea

Thanks for the advice.

I tried the tool and found the same effects as with my solution. I use the default theme and even with my own I have filled pads. This seems to be a “problem” of Kicad itself. Or it is desired and not even a problem.

I know it from EAGLE that the soldering pads in the printouts are cleanly cut out in the middle.

It would be great if Kicad could do the same.

Greetings

David

1 Like

Hi Stefan,

Thanks - I checked it out and it also looks interesting - but: same “problem” as with my own (way simpler) solution. I’m looking for a simple solution for a simple problem and I don’t want to have all the dependencies like python and so on.

Still - your answer is highly appreciated!

Hello Paul,

Thank you for your answer.
Unfortunately, it doesn’t help me at all and doesn’t contain anything helpful apart from wise guy content.

Greetings
David

I was hoping to explain the WHY you get what you get, which might help SOME people to understand why they get what they get: flaming me helps no-one!

As I said, there is 100% logic in the holes on that plot being filled in, as I believe “plotting” is used to create the details for manufacture, I guess exporting does the same.

Ok, another idea for you: have you tried to PRINT the PCB (print to the Microsoft / other PDF printer)? If you print the copper layers, there’s holes in the pads! Like this:

To make that image I did a print in colour, then set my printer to be the PDF printer: looks good to me. Just select which layers you want - make sure to select the “Drill Marks” to be “Real Drill” . You may need to have a play to get what you want. If you select “Black & white” then you end up with a lot of black on top of black :frowning:

Ok, how about his (may need a bit of playing), but in Print, I selected the F.Silkscreen, F.Fab and the edge cuts, and went with B&W:

(for some odd reason, my component values, which SHOULD be in my F.Silkscreen layer, don’t show up if I just select the F.Silkscreen layer!! Version 6.x)

(the Print function has a very useful “preview” option, so you can quickly see the effects of selecting different layers, colour vs B&W etc…)

Another possibility might be to select your desired layers in Kicad (in “appearance” menus) then do an image grab? With custom colours, might give you something usable?

If YOU don’t find this comment helpful, then dump any flames in the (fireproof) bin, I’m just trying to help you and others…

Hello Paul,

I’m truly sorry, I didn’t mean to offend you or question your good intentions.
Thank you also for additional, very detailed information.

Printing via a virtual PDF printer works in most cases with the correct result, the pads have holes in them. However, this process cannot be automated (at least as far as I know).
In most cases - there are boards of mine where it doesn’t work and where, for example, it works great on the front and not on the back… I can’t understand the different behavior.

For now, I will live with the fact that KiCad’s behavior is just that. Otherwise I’m very happy and maybe one day it will be fixed.

The screenshot always works, of course, but it can’t be automated either and I don’t get a vector graphic. Furthermore, you always have to edit the resulting images somehow - that’s not in the sense of an automated solution.

How does the community generally feel about this? Is this desirable or does nobody, apart from me as a fussy engineer, need it anymore?

Kind Regards
David

That must be a “fast and furious” production line you are running, if you churn out so many PCBs that you don’t have the time to use the GUI :slight_smile:

Do you REALLY need to have vector formats? Interested to understand why, if you do. Back in days of yore, when the resolution of graphics was low, vector graphics make a lot of sense, but I’m thinking not so much now.

(Several years ago - when available bandwidth was a LOT lower - there was a printing solution for Citrix, to try to reduce the bandwidth used over WAN links for graphics. What it did was to convert the document to PDF with lower resolution images. I had a customer, an estate agent (aka realtor in US terms) who wanted to print house pictures, so I got some examples, and tried bandwidth reducing them: after all, with a 3" x 3" picture, do you REALLY need to be identify the individual leaves on the trees? Apparently he did! :slight_smile: )