GerberZipper, plot and zip plugin

I have created a plugin that automatically plots and zip necessary files for a given board vendor.

So far, there are few vendors that support it, and I have confirmed that it works only under Windows environment.

I would welcome reports on other environments and board vendors you use often.

GitHub : gerberzipper

9 Likes

I use Linux exclusively, but still some remarks:

I always check gerbers in a gerber viewer, so a plugin to do automatic zipping would not add much for me. Then there are extra complications because even if you always use the same manufacturer, you still may want to adjust several settings before making gerbers. Not all PCB’s are 2 layer boards. some have gold plating, manufacturers offer different price points for different accuracy classes, etc.

But I see something else on the horizon. There are quite a lot of settings for generating Gerbers:

To have an easy and quick way to Save or Load these settings from a file does seem a very useful option. This seems such a logical option that I suspect it’s already a wishlist item on gitlab.

This option is for example already implemented for Hotkeys:
Pcbnew / Preferences / Preferences / Hotkeys and then: [Import] or [Export].

Edit:
Thumbs up by me from 6 to 7 on:


The topic itself is about all the plot settings, but Gerbers are mentioned explicitly. Part of the Idea is that PCB manufacturers can make such a file available for KiCad that works with their process.

Great, thanks very much, this should save a bit of repetitive interaction. Will install it soon.

Just one comment and it isn’t a criticism. When I saw this sentence I thought you meant that it only works under Windows.

But I realised you meant “I have confirmed only under the Windows environment that it works”. Only is one of those words that’s very sensitive to placement within a sentence.

Hi, I did a check between what’s generated by the plugin and a manual generated plot. I adjusted a JSON entry for the same parameters as the default settings I use for most Chinese fabs. For most of the layers the only differences were the creation timestamps. But the front and back copper layers had significant differences. The output from the plugin is larger and I’ve found that it’s due to additional lines. Here’s the start of the differences for one project.

+%ADD25C,0.350000*%
 G04 APERTURE END LIST*
 D10*
 X81240000Y-106680000D03*
@@ -9647,4 +9648,258 @@
 X68199000Y-53193000D01*
 X68453000Y-53193000D01*
 X68453000Y-53213000D01*
+D25*
+X90009100Y-86315200D03*
+X81240000Y-106680000D03*
+X78740000Y-106680000D03*
+X93900000Y-106680000D03*
+X88900000Y-106680000D03*
and many more lines

Unfortunately I don’t understand G codes to know what effect this extra line, and all the lines related to this, have:

%ADD25C,0.350000*%

I haven’t detected any visual difference in the gerber preview but I don’t know what to look for. Is there some other setting that affects the copper layer output?

Thank you!
I did some investigation.
The extra Gerber data seems to be a small dot at the drill location on the Cu layer.

This is controlled by the DrillMarksType setting, which is not shown in the Plot dialog. And it is OFF in the plot dialog but it seems to be ON by default in the Python API.

I updated the plugin and set it to be equal to the Plot dialog.

Thank you for the Info :slight_smile:
I’m not sure if it’s a config file or a python script, but I also hope that Fab will eventually provide the configuration needed for manufacturing.

Thanks! :+1: :+1: :grinning:

Hi, there seems to be an extra line of code which causes 2 copies of each file to be added to the zip. At the same time I made the compression method DEFLATED as with the command line zip. I hope DEFLATED is supported on all platforms.

@@ -11,6 +11,7 @@
 import wx.grid
 import os
 import locale
+import zlib
 import zipfile
 import glob
 import json
@@ -621,12 +622,11 @@
 
                 # ZIP
                     message('Zip')
-                    with zipfile.ZipFile(zip_fname,'w') as f:
+                    with zipfile.ZipFile(zip_fname,'w',compression=zipfile.ZIP_DEFLATED) as f:
                         for i in range(len(zipfiles)):
                             fnam = zipfiles[i]
                             if os.path.exists(fnam):
                                 f.write(fnam, os.path.basename(fnam))
-                            f.write(fnam, os.path.basename(fnam))
                     wx.MessageBox(getstr('COMPLETE') % zip_fname, 'Gerber Zipper', wx.OK|wx.ICON_INFORMATION)
                 except Exception as err:
                     alert(err.message)

Thank you! That is my mistake.
I have just updated.

It doesn’t registry (appear) on KiCad Nightly at Linux. Maybe some import/registry missing.

I think the import of this project could help to fix.

Could be added the capability to generate the position files and the direct web page ZIP submission.

Also agree with @paulvdh, should have a checkbox for open the ZIP (gerbers and drill) at Gerberview at the end of the process.

Thank you for the report and info. Ive updated the install description.

Or the possibility to generate all files (to review them individually) and the zip file in the same directory.

Yes, GerberZipper already generates individual gerber/drill files and a ZIP file that puts them together in the same directory.

I would like to make an option to pass them in and automatically start gerbview, but the problem is that some vendors require a .TXT extension as a drill file.
I think the only way to make gerbview recognize the TXT file as a drill file is to load it manually.

Hi, there is one more thing I noticed. After an export, the board is marked as changed such that the Save button is highlighted. To exit pcbnew without saving, one has to choose Discard Changes. Isn’t it more correct to not mark the board has changed since using Plot manually doesn’t mark the board as changed.

Thank you.
I have confirmed that.

However, in my investigation, it seems that just calling an empty plugin with no content causes modified state. I’m not sure if there is a way to control this from plugins.

Hmm that sounds like a bug.

I heard the following in GitLab issues. In v5.1, probably it becomes modified state always (because of changes to the UI state) . This issue is expected to be resolved in v6.

For reliable settings I suggest using a tool like KiPlot or KiBot (disclaimer: I’m author of KiBot).

You can create a configuration file with specific settings for each manufacturer and select a directory to store the output files for each one. You can then call KiBot from a Makefile or from a CI/CD pipeline (i.e. a GitHub action). You’ll get separated output files with repeatable settings. The settings will come from the configuration file.

I just found this old issue/feature propose mine