A Sample Script for Linux GDS to Gerber

by
Steve DiBartolomeo
Applications Manager
Artwork Conversion Software, Inc.

Created: February 25, 2015

The Batch File

The variable BINDIR should be set prior to running this script. This tells the script where the gds2gbr exectuable is located. For example, if you installed gds2gbr such that the executable was in /home/CAD/asm600/gds2gbr/bin then this is the value you would set for BINDIR.

#! /bin/sh
# first we check that BINDIR is defined correctly
# if not, tell the user and exit

if [ ".${BINDIR}" = "." ]
then
BINDIR=../bin
echo
echo BINDIR is not defined
echo
echo
echo using \$BINDIR to be \"${BINDIR}\"
echo
else
echo
echo using \$BINDIR to be \"${BINDIR}\"
echo
fi
echo Hit Enter to continue...
read response

if ! [ -x "${BINDIR}/gds2gbr" ]
then
echo
echo can not find translator ${BINDIR}/gds2gbr
echo
exit
fi


# here we copy from the template to the GDS.CFG file
cp package_cfg  GDS.CFG

# here we copy from the template to the package.apt file
cp package_apt  package.apt

#
# gds2gbr will look for GDS.CFG by default in the current folder
# and this file makes a reference to package.apt
#
# it does this by looking at the GERBER keyword in the GDS.CFG file
#
# you can customize your settings by making changes in package_apt
#
# controlling the Gerber file settings
#
#
#         APTUNITS mm - Gerber output in MM
#
#         FORMAT 3.5  - Gerber format 3.5
#
#         #SUPPRESS CR - no CR after each line
#         #SUPPRESS LEADING  leading zeros are removed
#
#
#
#
# Next we launch the translator with all the arguments. Note
# that this is customized specific to the file we are processing.
# other files will have different layers and different top cell names

"${BINDIR}/gds2gbr" package.gds x 0.025 5,6,7 1.0 package -p -t1

# now we launch Xgbrvu and using the info in the job file tell it what
# files to load

"${BINDIR}/xgbrvu" -dabackgd black -daforegd white  package_gbrvu.job

The Aperture File - from package_apt

The aperture file template includes the following lines:

APTUNITS mm          <-- this sets Gerber units to mm
ARCRES 9.0
ARCSAG 0.0
CIRCULAR off
FONT ../bin/txt.shx
FORMAT 3.5          <-- this sets Gerber data format to 3.5
LINE d10
MSCALE 1.0
START_APT d10
OUTLINE on d30 d31  <-- this tells program to use G36/G37
GBR_END M02
ABSOLUTE on         <-- this sets Gerber to absolute coords
CIRANG 360
GBRTYPE RS274D
FLASH on
TRACE mode1
PEND 0
#SUPPRESS CR       <-- this removes CR/LF at end of each line
#SUPPRESS LEADING  <-- this removes leading zeros
OFFSET0 0.0 0.0
D10  0.025                            d Round   0.025   0.025  
D11  0.05                             d Round   0.05    0.05   
D12  0.1                              d Round   0.1     0.1    
D13  0.2                              d Round   0.2     0.2    
D14  0.4                              d Round   0.4     0.4    
D15  0.8                              d Round   0.8     0.8    
D16  1.5                              d Round   1.5     1.5    
D17  2                                d Round   2       2      
D18  2.5                              d Round   2.5     2.5    
D20  0.0609                           d Round   0.0609  0.0609 
D21  0.1016                           d Round   0.1016  0.1016 
D22  .2032                            d Round   0.2032  0.2032 
D23  .5                               d Round   0.5     0.5    
D30  0                                d Poex    0       0      
D31  0                                d Poex    0       0     

The Configuration File (.cfg)

Here is the configuration file used for this particular conversion. This file is not likely to change when the input file changes.
GDSUNITS
1000
UM

TSCALE
1
1
1
1

ASCALE
1

ARCRES
9

GERBER         
package.apt   <-- this points to the name of the aperture file

MAXERR
10

ARCSAG
0.2

ERROR_LAYER
-1

SCALE_FACTOR
1

MAP_CIRCLES
YES

MITER
OFF




The gds2gbr Command Line Syntax

Here is what our batch/script used to run the conversion actually does:

"${BINDIR}/gds2gbr" package.gds x 0.025 5,6,7 1.0 package -p -t1

where:

"${BINDIR}/gds2gbr"   path/filename of the translator executable
package.gds           input file (it is in the current directory)
x                     place holder
0.025                 diameter of starting aperature (legacy)
5,6,7                 GDSI layers to convert to Gerber
1.0                   scale fator
package               input file top cell name
-p                    suppress banner
-t1                   trace mode 1 (paths to draws)

we don't need the reference to GDS.CFG if it is present in the current directory



The Xgbrvu Job File

This tells GBRVU what files to open, what colors/pattern to assign and what aperture file to use.

:Ver   100
:Cfg   package.apt
:Drw   packag05.gbr
:OnOff on
:Color red
:Fill  2
:Drw   packag06.gbr
:OnOff on
:Color green
:Fill  3
:Drw   packag07.gbr
:OnOff on
:Color yellow
:Fill  4




ARTWORK CONVERSION SOFTWARE, INC.       Company Profile
417 Ingalls St., Santa Cruz, CA 95060    Tel (831) 426-6163     Fax 426-2824    email: info@artwork.com