Skip to content

Commit

Permalink
Add outlineLayers option to config file
Browse files Browse the repository at this point in the history
The outlineLayers option can be used to specify which layers have
the entire panel outline (which would otherwise be rendered only
to the 'outlineLayerFile' file) rendered onto them.
  • Loading branch information
space-age-robotics committed Apr 25, 2012
1 parent e7d55cb commit 5078c7b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gerbmerge/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'excellondecimals': 4, # Number of digits after the decimal point in input Excellon files
'excellonleadingzeros': 0, # Generate leading zeros in merged Excellon output file
'outlinelayerfile': None, # Name of file to which to write simple box outline, or None
'outlinelayers': None, # e.g., *toplayer, *bottomlayer
'scoringfile': None, # Name of file to which to write scoring data, or None
'leftmargin': 0, # Inches of extra room to leave on left side of panel for tooling
'topmargin': 0, # Inches of extra room to leave on top side of panel for tooling
Expand Down Expand Up @@ -254,7 +255,9 @@ def parseConfigFile(fname, Config=Config, Jobs=Jobs):
Config['cutlinelayers'] = parseStringList(Config['cutlinelayers'])
if Config['cropmarklayers']:
Config['cropmarklayers'] = parseStringList(Config['cropmarklayers'])

if Config['outlinelayers']:
Config['outlinelayers'] = parseStringList(Config['outlinelayers'])

# Process list of minimum feature dimensions
if Config['minimumfeaturesize']:
temp = Config['minimumfeaturesize'].split(",")
Expand Down
20 changes: 19 additions & 1 deletion gerbmerge/gerbmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,22 @@ def writeFiducials(fid, drawcode, OriginX, OriginY, MaxXExtent, MaxYExtent):
y = MaxYExtent + y
fid.write('X%07dY%07dD03*\n' % (util.in2gerb(x), util.in2gerb(y)))

def writeOutline(fid, OriginX, OriginY, MaxXExtent, MaxYExtent):
# Write width-1 aperture to file
AP = aptable.Aperture(aptable.Circle, 'D10', 0.001)
AP.writeDef(fid)

# Choose drawing aperture D10
fid.write('D10*\n')

# Draw the rectangle
fid.write('X%07dY%07dD02*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(MaxYExtent))) # Top-left
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(MaxYExtent))) # Top-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(MaxXExtent), util.in2gerb(OriginY))) # Bottom-right
fid.write('X%07dY%07dD01*\n' % (util.in2gerb(OriginX), util.in2gerb(OriginY))) # Bottom-left


def writeCropMarks(fid, drawing_code, OriginX, OriginY, MaxXExtent, MaxYExtent):
"""Add corner crop marks on the given layer"""

Expand Down Expand Up @@ -517,7 +533,9 @@ def merge(opts, args, gui = None):
writeFiducials(fid, drawing_code_fiducial_copper, OriginX, OriginY, MaxXExtent, MaxYExtent)
elif ((layername=='*topsoldermask') or (layername=='*bottomsoldermask')):
writeFiducials(fid, drawing_code_fiducial_soldermask, OriginX, OriginY, MaxXExtent, MaxYExtent)

if config.Config['outlinelayers'] and (layername in config.Config['outlinelayers']):
writeOutline(fid, OriginX, OriginY, MaxXExtent, MaxYExtent)

writeGerberFooter(fid)
fid.close()

Expand Down

0 comments on commit 5078c7b

Please # to comment.