web page logo

Introduction

GDS2GBR CSV is a custom conversion software developed to address a problem -- certain small GDSII files when converted to Gerber generate very large Gerber files. Such large Gerber files, approaching 1 GB, can cause the target system to run very slowly or not at all.

These GDSII files consist of a few small cells which are placed in a quasi-array. However instead of using an AREF command (which could be converted to a Gerber SR command) each placement is unique because it is slightly off the ideal array position and it may be slightly rotated.

While GDSII supports placements with rotation, Gerber does not. Hence the Gerber file must be "flat" and the resulting file becomes too large to easily process.


Solution

The solution requested is to analyze the hierarchy of the GDSII data and to only produce as Gerber unique cells that are placed multiple times.

The actual placement information is handled in a separate file - a comma delimited file (CSV) that supports X,Y position, rotation and mirroring. The target system can easily process the individual cell data and then uses the CSV information to place the cell as needed in the image area.


Command Line Syntax


gds2gbrcsv  input_gdsii  output_directory  top_structure  layers  [options]

where:

gds2gbrcsv            full path and filename to the executable gds2gbrcsv.exe


input_gdsii           full path and name of the GDSII file to process. If spaces or
                      special characters are present surround this argument with
                      "double" quotes.

output_dir            full path to the output directory where the Gerber file(s)
                      and CSV file will be written. If spaces or special
                      characters are present surround this argument with
                      "double" quotes. This directory will be created so the
                      directory should not already exist.

top_structure         the name of the GDSII file's structure to start from. If
                      it is the file's top level structure then the argument
                      can be set to = and the program will determine the top
                      level structure automatically.

layers                specify which GDSII layer(s) to process.
                      use the equal sign "=" to indicate all layers
                      use a list such as +29 for layer 29 (and all its datatypes)
                      use a list such as +29+31 to merge multiple GDSII layers
                      into a single Gerber file.

[Options]

 -h                   display the syntax help.

 -min_repeat:VAL      minimum number of repeat placements in order to recognize
                      as a repeated cell. Default=2.

 -overlap:VALUE       re-entrant polygons will be converted to "butting" polygons
                      and shared edges will be offset to provide this amount
                      of overlap. Default = 0.01 mm for Gerber files in units of
                      mm and 0.0004 for Gerber files in units of inches.


 -unit:[mm | inch]    units for the Gerber file. Default = mm
                      if mm, default format = 3.5
                      if inch, default format = 2.6

-format:MN            if present overrides the default format. i.e. -format:36 would
                      force Gerber format to 3.6 instead of the 3.5 default.

 -arcsag:val          The chord error to use when "recovering" arcs from the
                      GDSII input. Default = 0.001 mm for Gerber files in
                      mm and 0.00004 for Gerber files in inches.

 -sort:[X | Y]        sort placements in the CSV in increasing order of X
                      or increasing order of Y. Default = X

 -no_sort             disables the sort routine.


 -workdir:PATH        specify a full path to the location where temporary working
                      files are to be written. Surround in double quotes if it
                      includes spaces.

 
 -log[:filename]      a full path and filename to the log file. If the filename
                      is not specified it defaults to the "output_dir" name.

 -thrnum:N            Number of concurrent threads to use during the conversion
                      from re-entrant polygons to butting polygons and for the
                      computations needed for edge overlap. Number of threads
                      used in arc recovery.

-log:filename         if present, a log file of the specified name will be generated.

 -verbose             turns on detailed messaging.


Example Command Line

We want to convert a GDSII file called example1.gds which is located in D:\cad_data\gds2gbr_csv into Gerber file located in the output directory D:\cad_data\gds2gbr_csv\output. We want temporary files to go into D:\cad_data\gds2gbr_csv\working

[Note: there are no line breaks in the command line. They appear here because of formatting needed to annotate each argument.]


"C:\wcad\gbr2csv\gds2gbrcsv.exe"              full path to program executable

"D:\cad_data\gds2gbr_csv\example1.gds"        full path to the input GDSII file

"D:\cad_data\gds2gbr_csv\output"              full path to output directory

=                                             direct program to determine the GDSII
                                              file's top level structure

+29                                           convert layer 29 (and all its datatypes)

-min_repeat:2                                 minimum repeat value is 2

-overlap:0.005                                overlap butting edges by 0.005 mm

"-workdir:D:\cad_data\gds2gbr_csv\working"    temporary working files go here

-thrnum:4                                     use 4 concurrent threads




Example Output

After running our GDSII file through the gds2gbrcsv program we now find in the output directory the following set of files:

Filename Comment Size
example1.csv The CSV (comma delimited file) that contains the placement information. 226 KB
PRDL1_PKG_OOS.gbr A "cell" that has been placed 1925 times. 125 KB
PRDL1_D_0_PRSTM_SFT_1.gbr A "cell" that has been placed 3645 times. 105 KB
Frame.gbr All data that does not have multiple placements. (i.e. this is placed once) 882 KB
DUMMY_METAL_1.gbr A cell that has been placed 231 times 5 KB


The CSV Syntax

Let's annotate the CSV file to explain the syntax.


UNITS, MM                                  UNITS keyword followed by MM | INCH
Frame.GBR,1                                name of Gerber file followed by # of insertions
0.00000,0.00000,0.000000,N,1.000000        Placement: X, Y, Angle, MirrorFlag, Scale
DUMMY_METAL_1.GBR,231                      name of Gerber file followed by # of insertions
-142.38000,-26.88000,0.000000,N,1.000000   Placement
-142.38000,-23.52000,0.000000,N,1.000000   Placement
-142.38000,-20.16000,0.000000,N,1.000000   Placement
.
.
.
PRDL1_PKG_OOS.GBR,1925                     name of Gerber file followed by # of insertions
-142.38000,-6.72000,0.000000,N,1.000000    Placement
-142.38000,-3.36000,0.000000,N,1.000000    Placement
-142.38000,0.00000,0.000000,N,1.000000     Placement
.
.
.
PRDL1_D_0_PRSTM_SFT_1.GBR,3645             name of Gerber file followed by # of insertions
-139.02139,16.81331,0.027273,N,1.000000    Placement
-139.01858,20.16411,359.939381,N,1.000000  Placement
-139.01753,-3.34641,0.056608,N,1.000000    Placement
.
.
.

Return Codes

The program issues the following return codes:

 0Finished Successfully.
-1Invalid Argument List.
-2License error.
-3Preprocessing GDSII failed; could not find repeating cells.
-4Failed to scale the output data to the user-specified units.
-5Failed to create CSV.
-6Failed to create GBR.

Download

gds2gbrcsv.win32_64.v105.exe   1/31/2017 v1.05 19 MBytes


Revision History

gds2gbrcsv v1.05 1/31/2017

Bug Fix - Extracting Top Cell

Previous versions had bug in automatically extracting the top level cell when the "=" was used on the command line. Instead, the program looked for a top level cell named TOP. This has been fixed.




gds2gbrcsv v1.04 1/11/2017

Bug Fix - Mirror Cell Data

Previous versions could not handle mirrored cell data. This has been fixed.




gds2gbrcsv v1.03 12/20/2016

Bug Fix - path names with spaces

Previous versions could not process a file if the name or directory including a space. This has been fixed.


Temporary Scan Files Now Deleted

Temporary GDSII scan files .ssn (created by GDSFILT) were left in the input directory. This has been fixed.




gds2gbrcsv v1.02 12/01/2016

-h correction

Corrects the -h display to make the syntax of the -format command clearer.




gds2gbrcsv v1.01 11/26/2016

Gerber Output Format

Enables the user to set the Gerber output format statement instead of forcing it to 2.6 for inches and 3.5 for mm.(Note, as this is done at the back end of the conversion, one cannot expect to get more precision in the output than with the previous versions.

Verbose Option Added

the command line option, -verbose, has been added to increase detail to the log file.

Logging Added

a log file option has been added.

Temp File Removal

temporary files that were not previously cleaned up are now removed when the conversion is complete.




gds2gbrcsv v1.00 08/26/2016

Initial Release

This is the initial release of gds2gbrcsv.

product ID=92416; no other product ID's needed.