SMD Stencil Creation - apertus° wiki


[edit] Required Software

I am using Ubuntu but I am sure those or similar packages are also available in other distros/package managers:

  • Eagle (free edition is enough)
  • Python version 2.4 or later
apt-get install python
  • SimpleParse version 2.1.0 or later
apt-get install python-simpleparse
  • gerbmerge 1.8 or higher
  • gerbv (a Gerber File Viewer)
apt-get install gerbv

We created our own fork of gerbmerge that adds some SMD stencil related features:

[edit] Introduction

We want to fill an SMD stencil with as many PCBs to make optimal use of the space.

The top and bottom cream layers together with the board outlines are exported through Eagle as CAM job and then processed with gerbmerge and manual absolute placement to create one combined gerber file that can be sent to an SMD stencil manufacturer.

[edit] External Manuals & References

[edit] 1. Export Gerber Files from Eagle

Eagle CAM Job to create required gerber files (plus a few others that we don't need for the stencils):

File:OSHPark-4layer File:OSHPark-4layer

Note: Make sure the bottom cream side has the "mirror" checkbox checked when running the job.

The three essential files/layers we need are:

  1. Cream Top (*.tcream.ger)
  2. Cream Bottom (*.bcream.ger)
  3. Board Outline (*.boardoutline.ger)

[edit] 2. Create gerbmerg configuration files

We want to merge 3 gerber files here for demonstration purposes (later we want to fill one stencil with as many boards as possible to not waste space): The general stencil frame with holes for fixing the stencil with screws and one PCB with top and bottom sides.

create an empty file called empty (gerbmerge requires a drill file or will throw an error - but is happy with an empty one)

create job.cfg with the following content (file names are left in for demonstration purpose):


projdir = .


AllowMissingLayers = 1

PanelWidth = 12.9
PanelHeight = 18.5




Create a file called stencilplacement.txt with the following content:

StencilTemplate 0.500 0.500
DummyBottom 5.000 2.000
DummyTop 2.000 2.000

For rotating certain boards use a syntax like this:

StencilTemplate*rotated 0.500 0.500
DummyBottom*rotated90 5.000 2.000
DummyTop*rotated180 2.000 2.000
DummyTop2*rotated270 2.000 2.000

Our gerbmerge fork also takes additional parameters together with the coordinates:

To define the origin of each board:

X Axis:

l = left
c = center
r = right

Y Axis:

b = bottom
c = center
t = top

Another letter can follow to define the relative position from the panel:

X Axis:

L = left
C = center
R = right
l = left obeying insets
c = left obeying insets
r = left obeying insets

So for example this line places the board exactly in the center of the panel:

board 0cC 0cC


The gerbmerge automatically creates boundary rectangles of each board to simplificy placement. As the StencilTemplate has no BoardOutline the first hole on it will be moved right at the original of the output gerber file so we have to manually offset the stencil template by half an inch in X and Y axis.

[edit] 3. Run gerbmerg and Inspect the results in gerbv

python --place-file=stencilplacement.txt  job.cfg

gerbmerge will ask you to agree to its warranty notice and output a few lines with board dimensions and the output files it created.

For our config:

../gerbmerge.git/gerbmerge/ -s --no-trim-gerber --place-file=placement_0001.txt job_0001.cfg

Look at the resulting files in the gerber file viewer gerbv:



© 2017 apertus° Community • Theme based on work by BorkWeb • Powered by MediaWiki