web page logo for GBR2DXF


Running the GBR2DXF Engine

The GBR2DXF program has two parts - a user interface (GUI) that collects the information about the translation and an engine that actually does the conversion. If you wanted to run GBR2DXF from another program you can call the engine directly. To do so, you must know the correct command line syntax and also what resource files must be produced in advance of calling the engine.


Command Line Syntax


1. Generate Artwork job and aperture file from RS274X Gerber File

c:\DIR\rs274xjb.exe c:\tmp\demo.art

   This will generate the job file, demo.job, the aperture file, demo.apt and possibly a set of macro files, rs274mac.* if the 274X file contains aperture macro definitions.  These macro files are referenced by the aperture and are necessary for translation. After running rs274xjb.exe, refer to sections 2. and sections 3. for further control settings your application may wish to modify in the job and aperture files.

If you are dealing with RS274D, then your application will have to generate the .job and .apt file on its own. The guidelines for the Job and Apt files are shown below.


OR


2. Generate Artwork job file for RS274D Standard Gerber

Example of a job file

 [General]
 layers=layer1,layer2
 aptfile=C:\tmp\1.APT

 [layer1]
 layer=1,C:\tmp\1.GBR
 dxfcolor=1

 [layer2]
 layer=2,C:\tmp\2.GBR
 dxfcolor=2

Explanation

This job contains 2 layers: layer1 and layer2.

where

The aperture file used for this job is c:\tmp\1.apt as specified in aptfile.

 

The DXF output unit is dxfunit=INCH and output to dxffile=c:\tmp\1.dxf.  The color in the DXF output for each gerber file is defined in dxfcolor=1 and dxfcolor=2.

Note:the dxfcolor line is not generated automatically by the rs274job.exe program but your application could add it in manually if you need to control the DXF layer color.


Generating APT file for RS274D Standard Gerber

This can be problematic if you are accepting RS274D files from a variety of sources since there is no agreed upon format for the aperture information. Below is the syntax needed by the gbr2dxf engine.

Aperture File Example

APTUNITS inch
Gerber and aperture unit (inch | mm)
FORMAT 2.4                  
Format of the gerber file
SUPPRESS LEADING
or
SUPPRESS TRAILING
Data in gerber file have leading zeros suppressed
or
Data in gerber file have trailing zeros suppressed
CIRANG 90
or
CIRANG 360                  
arcs use circular 90 degree mode (uncommon)
or
arcs use circular 360 degree mode.
ABSOLUTE on
or
ABSOLUTE off                
Data in gerber file are in absolute mode.

Data in gerber file are in incremental mode.
PEND 0
or
PEND 1                      
Output DXF in connectivity mode.
or
Output DXF in graphics mode

If PEND 1 is used, then the command line must include the argument -we
FLASH on
or
FLASH off
or
FLASH on2 
or
FLASH tff
Solid and Block flashes.
or
Solid and Explode flashes.
or
Outline and Block Flashes.
or
Outline and Explode flashes.
CIRCULAR on
Always fixed to this setting.
GBR_END M02
Always fixed to this setting.

Aperture Definitions Follow

Apertures used for drawing are separate from apertures used as flashes. This is a legacy behavior from gbr2dxf's early design.

D10 0.0000 d Round 0.0010 0.0010
Dcode 10 is a round drawing aperture
D11 BLOCK11 f Rect 0.0300 0.0200
Dcode 11 is a rectangular flash and placed as BLOCK11 in the DXF file.


                                   

3. Running the Engine

Assuming that you have correctly created the .job and .apt (and .mac files if coming from RS274X) then you are ready to launch the translation engine. The command line is broken into multiple lines for clarity but of course, you should not do so.

c:\wcad\asm500\gbr2gdxd.exe
  "-cfg:c:\tmp\demo.apt"
   "-out:c:\tmp\demo.dxf"
     -f "c:\tmp\demo.job"
       [-s:Scale]
        [-we]
         <-cir+ | -cir->
            [-r14]


where

-cfg:
specifies the path/name of the aperture file.

-out:
specifies the DXF output file path/name.

-f
specifies the name/path of the job file. [The job file contains the name(s) of the Gerber file(s) to process]

-s:Scale
Scale is a conversion factor depending on the input and output units.
INCH to INCH  not necessary
INCH to MIL   -s:1000.0
INCH to CM    -s:2.54
INCH to MM    -s:25.4
INCH to UM    -s:25400
MM   to MM    not necessary
MM   to INCH  -s:0.03937
MM   to MIL    -s:39.37
MM   to CM     -s:0.1
MM   to UM     -s:1000.0

               
-we
use graphics mode in which the DXF output looks the same as the gerber input. Default is connectivity mode.

               
-cir+
output circle as circle entity in DXF
          
-cir-
output circle as using AutoCAD polyline entity.
 
                .
-r14
output DXF using AutoCAD release 14 light weight polyline.