Running GDS2GBR from a Script

Steve DiBartolomeo
Applications Manager
Artwork Conversion Software, Inc.

Created: September 6, 2005
Revised: February 24, 2015


The gds2gbr translation engine requires two configuration files -- an aperture list which contains both Gerber aperture definitions and some directives about the conversion process and a configuration file which contains some information about the GDSII file and also some conversion directives. A command line then executes the engine.

gds2gbr flow

The Aperture File

The aperture file contains essential information for the converter. It includes:

  • the Gerber format, units, mode and coordinates.
  • a list of apertures that the converter may use.
  • translation directives.

There are quite a few possible entries in the aperture file that are not germane to a gdsii to gerber translation so we will not discuss those here.

Example of an Aperture File

Comments are in italics. Generally there are no spaces between the lines of the aperture file. The order in which the directives are placed is generally not important.

APTUNITS MM             Gerber and aperture unit, INCH or MM (reqd)

FORMAT 3.3              Format of the gerber file (reqd)

LINE D13                Line Dcode (reqd) this D-code would be used for any entities
                        that do not have a finite width associated with them.

TRACE OFF               Trace mode - off | mode1 | mode2 | mode3 (reqd)
                        Trace mode is generally set to off unless the user 
                        wants GDSII paths to be mapped to Gerber draws of the
                        same width.

OUTLINE on d20 d21      Controls how boundaries are processed. (reqd)
                        arguments are:

                        to stroke fill use: OUTLINE off
                        to outline boundaries use: OUTLINE on d10 d11

                        where 2 distinct outline dcodes should be specified.
                        the need for two d-codes is a legacy workaround for FIRE 9000

CUTLINES keep           To preserve GDSII cutlines use: CUTLINES keep  
                        To remove GDSII cutlines use: CUTLINES remove

SUPPRESS LEADING        leading zeros suppressed (recommended)
SUPPRESS TRAILING       trailing zeros suppressed (not recommended)

                        To specify no suppression, do not put SUPPRESS LEADING 
                        or TRAILING in the aperture file.

SUPPRESS CR             Use this diretive to suppress CR/LF at end of each
                        Gerber command. This reduces file size by about 10%.
                        To output CR/LF, do not specify SUPPRESS CR.

TEXT D13                Specifies the D-code to be used to stroke text.
                        For auto, put a numeric value such as 7 instead of a dcode.
                        e.g. TEXT 7

FONT c:\wcad\asm600\p.shx           Font file name for text font (must point to a .shx file)
                                    if your file has no text you can skip these two parameters.

D10 0.05 d Round 0.05 0.05          Dcode 10 is a round draw (pay attention to units)

D11 C_0254 f Round 0.025 0.025      Dcode 11 is a round flash for circles in the GDSII file
                                    In this example, 0.0254cm (diameter) circles are 
                                    flashed using .025 mm aperture on D11.
                                    Refer to the .cir file for circles and 
                                    polyline information.

D12 STRUCT1 f Round 0.050 0.050     Structures in the GDSII file can also be flashed 
                                    as a dcode. Specify the structure name to flash.

Some Comments on the Aperture File

We recommend that your apt file units (i.e. your Gerber units) match your GDSII units. So if the GDSII file is in mm or um then use MM for Gerber. If GDSII user units are in mils or inches then use INCH for Gerber. If not, you will need to make various scaling adjustments.

The Configuration File (.cfg)

The configuration file (.cfg) is a legacy file left over from earlier module development - Many of its entries are repeated in other locations (i.e. the aperture file or the command line.)

  1000                       Grid of the GDSII file
  UM                         Unit of the GDSII file 

  1.0                        Translation scale

  1.000000                     Text scale for Font 0.
  1.000000                     Text scale for Font 1.
  1.000000                     Text scale for Font 2.
  1.000000                     Text scale for Font 3.

  OFF                         Set to OFF.

  OFF                         Miter ON or OFF.

  OFF                         Flash circle ON or OFF.

  NO                          Flash circle YES or NO.

  OFF                         Set to OFF. ( I have no idea what
                              this actually does!)

  1 /tmp/TOP01.gbr            Output GDSII layer 1 to /tmp/TOP01.gbr
  2 /tmp/TOP02.gbr            Output GDSII layer 2 to /tmp/TOP02.gbr

  /tmp/demo1.apt             tells translator where to find the aperture file.

  /cad/asm600/pgfont.shx     Font file for GDSII font 0 to 3
  /cad/asm600/pgfont.shx     Do not specify these 4 lines to turn off text/font

The gds2gbr Command Line Syntax

The translation engine is launched using a command line which points to the various resource files you have created. The syntax is shown below. (Note that there are no breaks in the command line - the breaks shown below are simple for clarity on this web page


  <input file> 


          <smallest dcode> 





                               [trace mode] 


                                         <-cfg:config file>


input file         the GDSII input file name. This should be a complete path.

x                  there must be an x as the 2nd argument. (legacy)

smallest dcode      the size of the smallest dcode (in mils or mm) specified 
                    in the aperture file. If no finite apertures were defined
                    in the aperture file then use: 1.0 for inch aperture unit 
                    or 0.025 for mm aperture unit.

layers              selected layers to translate separated by commas i.e. 1,2,7,8

scale               translation scale.  normally 1.0.

structure           the structure in the GDSII file to translate. If for some
                    reason the structure name has special characters in it,
                    which it should not, then use quotation marks with it ...
                    Structure name is case sensitive ...

-p                  -p must be the 7th argument. Again this is due to use of
                    legacy code (Actually controls suppression of banner)

-274x               directive to output RS274X format

trace mode          if off, do not put anything.
                    if mode 1, put -t1.  if mode 2, put -t2.  
                    if mode 3, put -t3.

-reentrant          specify this if removing cutlines.

-cfg:config file    specify the configuration file (typically gds.cfg).

Command Line Example

(breaks are shown only for clarity)









In this example it is assumed that the files demo1.gds and gds.cfg are both located in the current working directory from which the script is executed. Otherwise, a full path would be needed in front of "demo1.gds" and "gds.cfg".

A Sample Script for Linux

You can download a sample script for Linux: package_demo.tar.gz 75KB

Upon unpacking this file you should find:

417 Ingalls St., Santa Cruz, CA 95060    Tel (831) 426-6163     Fax 426-2824    email: