Gbrunmgr Command Line Examples

Gbrunmgr is extremely powerful and has an enormous number of options and controls as well as the ability to a number of different output formats. So we can't cover every possible command line possibility. We'll try to show the more common operations in the following examples.

Files, Paths and Abbreviations

When using the command line, best practice is to fully define the path as part of the filename. If you use relative path or no path then you risk your script or batch file breaking.

Current Directory - on Windows the batch/scripting variable for the current directory is %CD%. I typically like to place and execute my batch files from a directory which also holds the input data. I will use that convention in these examples.

Quoting of Directories - if a directory or file name has a space or special character in it the entire command should be surrounded by double quotes. i.e "-out:C:\Documents and Settings\steve\CAD Files\output.gbr" Do not do this: -out:"C:\Documents and Settings\steve\CAD_Files\output.gbr"

Command Line Breaks and Indents - In all the examples below you will see "breaks" in the command line. This is only for readability.

Executable - In all examples below I've used gbrunmgr.exe where normally I would use a full path such as C:\wcad\gbrvu\artwork\gbrunmgr.exe

1. Clip Out a Window and Convert to AutoCAD DXF

We want to convert a rectangular window of our file into a nice clean DXF that will be used for documentation purposes. We want a clean DXF layer even if the Gerber file has many internal layers. We will maintain the same units and coordinates as the Gerber input file.

gbrunmgr.exe                                 executable
   "%CD%\icsxseed.gbr"                       input RS274X file (units=inch)
        "-out:%CD%\output\icxseed.dxf"       output DXF file
            "-wdir:%CD%\working"             working directory

             -window:3.5,6.6,4.85,7.9        LLx,LLy,URx,URy to extract
               -outputtype:dxf               output file format
                 -polyformat:leonov          polygon format 
                    -arcsag:0.0002           arc smoothness


Below you can see our Gerber input file and the resulting DXF output of the window we selected:

The source Gerber file: icsxseed.gbr (example directory)

The clipped DXF file displayed in AutoCAD

This page describes how to use GBRUNION command line options to convert a few Gerber files to GDSII with layer mapping.

It can be done along with our gdsfilt as explained below. Please note that the Gbrunion can only generate single layer output so three Gerber files, for example, will have to be three GDSII outputs.
From here the methodology to follow is to use gdsfilt and map each output to a desired layer, and blend all outputs into a single GDSII file if it is desired to have only one output file.

Below is a three stage example which creates a multi layered GDSII output file:

(1) Generate a GDSII file for each Gerber file
    [5v.gds, gnd.gds, and top.gds are created from three different Gerber files]

[ ==> 5v.gds]
"c:\wcad\gbrvu\gbrunmgr.exe" "d:\temp\"  "-out:d:\temp\5v.gds" "-wdir:d:\temp" -outputtype:gds_stream -sizingvalue:0.000 -smoothingvalue:0.005 -maxpoints:2000 -arcres:45.000 -silent -singledlg

[ ==> gnd.gds]
"c:\wcad\gbrvu\gbrunmgr.exe" "d:\temp\" "-out:d:\temp\gnd.gds" "-wdir:d:\temp" -outputtype:gds_stream -sizingvalue:0.000 -smoothingvalue:0.005 -maxpoints:2000 -arcres:45.000 -silent -singledlg

[ ==> top.gds]
"c:\wcad\gbrvu\gbrunmgr.exe" "d:\temp\" "-out:d:\temp\top.gds" "-wdir:d:\temp" -outputtype:gds_stream -sizingvalue:0.000 -smoothingvalue:0.005 -maxpoints:2000 -arcres:45.000 -silent -singledlg

(2) Map outputs to desired layers [All output is initially on layer one]

[Map 5v layer one to layer five.]
c:\wcad\gbrvu\gdsfilte.exe d:\temp\5v.gds  d:\temp\5v_lyr1to5.gds  = -unixcmdline -lyr1:5

[Map gnd layer one to layer six.]
c:\wcad\gbrvu\gdsfilte.exe d:\temp\gnd.gds d:\temp\gnd_lyr1to6.gds = -unixcmdline -lyr1:6

[Map top layer one to layer seven.]
c:\wcad\gbrvu\gdsfilte.exe d:\temp\top.gds d:\temp\top_lyr1to7.gds = -unixcmdline -lyr1:7

(3) Blend all mapped GDSII output into one file
[Blend all three layer mapped files into one file called blend.gds]

c:\wcad\gbrvu\gdsfilte.exe d:\temp\5v_lyr1to5.gds d:\temp\blend.gds = -unixcmdline -blend d:\temp\gnd_lyr1to6.gds d:\temp\top_lyr1to7.gds


The gdsfilte.exe usage is as follows:

gdsfilte.exe inputfile outputfile topstr [options]

   outputfile is the GDS output file name.

   only topstr and its dependents are output. if topstr is '=' then, the structure with the deepest tree is selected.

   options can be some of

   -unixcmdline      Perform GDSII scan (necessary in this context)
   -lyrM:N,...       Remap layer range M to N.
   -dtpM:N,...       Remap datatype range M to N.
   -mapM%N:m%n,...   Remap layer:datatype(s) M:N to m:n.
   -blend f1 f2 ...  fn  blend files f1, f2 ... fn with inputfile.