Gerber Based Translators and Postprocessors


In modern versions of Artwork's software products that import Gerber (274x) data, the file is first submitted to a module called split274x which is used to condition the Gerber data. (You will not see split274x in the program directory because it is linked as a static library ... )

split274x is a library statically linked to the gbr_rip raster library.

Its purpose is to protect against a number of "pathological" conditions that are encountered with RS274X files. These include but are not limited to:

  1. 32 bit integer overflow related to the data format specification (e.g. a format statement of 5.6) as most Artwork software is limited to 32 signed integer operations.

  2. 32 bit integer overflow related to circular commands with shallow (large radius) arcs.

  3. Conflicting D-code Definitions .e.g D10 is first defined as a 10 mil Round and later on in the file D10 is defined to be a 50 mil square.

  4. Reduction of identical and nearly identical D-code definitions and macros (default tolerance is 1 um for equivalency - in some products this tolerance can be controlled by the end user)

  5. Breaking large vertex count polygons (including circular data that will be segmented) into many smaller pieces. We have seen users submit 274X files that include G36/G37 area fill polygons with more than 200K vertices.

  6. Correct for poorly constructed circular data (G02 and G03) and circular data that is inconsistent with G74 and G75 codes corresponding to 90° and 360° circular interpolation.

  7. Re-map Dcode definitions greater than 40000, e.g. ADD500000,C... will be redefined to use the first available Dcode number below 40000; Note that the latest RS274X specification allows Dcode enumeration up 32 bit values but many tools may not yet support that.

  8. When split274x is used with Artwork's Gerber rasterizers - Gerber data is made to conform to either format 3.5 (mm) or format 2.6 to maximize the precision of the rasterizer.

  9. Filter out duplicate or extremely closely spaced vertices.

  10. Size or offset polygon data to compensate for the diameter of the raster beam width.

This code was introduced in 2002 and has been regularly updated over the years when we encounter new issues.

Output File

Split27x does not modify the original file - it creates a new file. The new file name is based on the source file with the _fmtbest appended to the file name.

layer5.gbr -> layer5_gbr_fmtbest.gbr

You many encounter these files in the working directory of many of Artwork's converters.

Additional Functions

Split274x has additional internal functions that are independent of input file conditioning. These functions can be exposed by running:

c:\> split274x (or split274x64) -h

This will return the command line arguments

split274x: a 274X conversion utility, vx.p (rcs 1.397)
(C) 2002-2017 Artwork Conversion Software, Inc. (831) 426-6163

usage is

split274x64.exe input_file [options]


-rewrite:filename    rewrite input_file to filename remapping decodes to a list of unique ones

-rewrite!filename    forces the retention of the output file even if no violations were found.

-log:filename        write log to specified filename

-highest_dcode:N     set highest allowed Dcode value to be N (default 9999)

-macro_tol:X         set macro tolerance to X (defaults 0.001 mm, 0.00004 inch) This is
                     used when one has multiple macro definitions that are "essentially"
                     the same within a given tolerance. This will reduce the number of
                     macros defined in the file.

-comments            emit G04 comment records when optimizing Dcode table

-bigrad:M            M is used as a divisor into MAX_INT (231) to flag "large" 
                     radius data and potential integer overflow conditions. If the
                     radius exceeds MAX_INT/M, then the arc will be fractured into
                     a number of line segments -- using arcres or chord_error as the

-arcres:A            use A degrees for segmenting circular data (default = 1 degree)
                     used when -dpi:0 or "large" radius data is encountered

                     if sizing is on using the -dpi:DPI argument, the default value
                     of chord error is set to 1/DPI.

-chord_error:VU      use V (in units U) as the value for chord error when segmenting circular
                     data; allowed values for U are mm, um, inch and mils. U is required.
                     arcres is set to 45 degrees when the chord_error argument is used.

-circularize[:VU]    circularize data making use of parameters to -chord_error or optionally
                     use V (in units U) as the value for circularizing; use -dpi:0 so that
                     circular data will be "recircularized"; see notes to -dpi below.

-maxpts:N            limit max polygon vertex count to N (default 4096)
                     if -dpi:DPI is used, then all polygon (G36/G37) including ones with
                     circular data are fractured using arcres/chord_error. Then the 
                     maxpts computation kicks in.

                     Arcs can be recovered by using -circularize.

-fmt:NM              set format to be N.M

-fmt:auto            (default) check input format N.M against rules:
                       (1) (N < 1) or (N > 6) implies (N = 6)
                       (2) ((M + N) > 8) implies M = (8 - N)

-fmt:best            force output file format to be 3.5 or 2.6 for MM and INCH files respectively


If the incoming RS274X file has one of the MI or AS mass parameters
Split274x will perform the transformation and output a new file
without these mass parameters.

-mp_mia0b0           process as if %MIA0B0 appears in input file
                     no mirror

-mp_mia1b0           process as if %MIA1B0 appears in input file
                     mirror about the Y axis

-mp_mia0b1           process as if %MIA0B1 appears in input file
                     mirror about the X axis

-mp_mia1b1           process as if %MIA1B1 appears in input file
                     mirror about both X and Y axes

-mp_asaxby           process as if %ASAXBY appears in input file
                     no axis swap

-mp_asaybx           process as if %ASAYBX appears in input file
                     swap X and Y axes

-ignore_deprecated   ignore AS and MI mass parameters in input file

-ignore_mp_as        ignore AS Axis Select mass parameter

-ignore_mp_mi        ignore MI Mirror Image mass parameter

-tform               by default macro definitions are transformed when MI or 
                     AS are active; this option turns this behavior off

-pass_deprecated     pass through AS/MI parameters to output file but 
                     do not actually do any transformations on the data.

End Transformations

-rm_dup_pts:ARG      filter duplicate or nearly duplicate points. ARG can be either dpi
                     or a positive integer that determines "closeness". If ARG is the
                     string literal 'dpi' then points are considered the same if they 
                     are within 1/dpi of each other;

                     if an integer "closeness" is measured in grid points corresponding to
                     the format statement.

                     Example: if you are working in MM with format 3.5 and you set ARG=5
                     then two points that are 0.00005 (50 um) are considered the same
                     point and one is removed.

-dpi:DPI             normally used with -fmt:best; compensates polygon data,i.e. G36/G37
                     blocks by 1/2 pixel size indicated by DPI
                       DPI > 0 implies shrink
                       DPI < 0 implies grow (would normally not be used)
                       DPI == 0 results in no compensation but circular data is segmented

-thrnum:N            make use of N threads when sizing, polygon breaking (-maxpts) or 
                     circularizing. This overrides the default number of threads (which
                     is equal to logical number of cores/processors)

-verbose[:N]         set verbosity level

-zero_draws_ok       do not flag draws or flashes with zero width tool as an error

July 2018 - Updated split274x

The following enhancements were made to the split274x library and released with gbr_rip v7.43

1. retaining split274x (conditioned) output via the -keep_split! command line option to both GBR2TIFF and/or GBRPLT.DLL; from GBR2TIFF the retained output file will be of the form


3. new controls to split274x embedded in GBRPLT.DLL - these include

  1. -chord_error:VU - Value, Units
  2. -circularize[:VU] - optional Value, Units if not specified
  3. -keep_split!

5. multi-threaded sizing and large polygon breaking in split274x - - thrnum:N to split274x will over ride the default the max number of threads available on the compute machine default as determined by

  thread_num = sysinfo.dwNumberOfProcessors; 
  1. if it is intended to store conditioned Gerber files for reuse at a later time, large polygon breaking should be enforced with

     -dpi:0  -maxpts:4096 

    Any polygon over 5K vertices is considered to be "big" in GBRPLT.DLL

    Using these arguments will segment circular data with the precision given by the -chord_error:VU option (e.g. -chord_error:1um) and guarantee that no resulting polygon will exceed 4096. In addition, if the smallest sized files are to be archived the -circularize option should be used.

  2. sizing or compensation is controlled with the -dpi:V option, such that when V is positive, polygon data will be reduced by 1/2 the pixel size indicated by V; a negative value for V will cause growth.

6. a new GBRPLT.DLL API that allows you to get the name of the split274x output filename so that you can save it from your own application (static GBP_QSPLIT splitFunc; - see gbrplt.h); this is useful for archiving the conditioned data created by split274x

splitFunc = fn_gbpQRYSPLIT(hDll);

char *splitFile;
char Split274xOutputFile[_MAX_PATH];

  splitFile = NULL;

  rtnval = splitFunc(&splitFile);

  if((rtnval == 0) && KeepSplit) {
    struct _stati64 statbuf;
    if(_stati64(ARGV[1],&statbuf) == 0)
      Split274xOutputFile[0] = 0;
  } else
    Split274xOutputFile[0] = 0;

7. a new error condition has been added; specifically a Gerber file that appears to be truncated will be flagged as an error. The Gerber file must end with one of M00, M01, M02, M30, M1, M2 or M3. If not, split274x will return an error and not create any output.

8. split274x logging now reports the size of the output "split" file.

9. split274x now has commands that will create output that will emulate the presence of MI and AS mass parameters to provide the ability to create rotated and mirrored files.


-mp_mia0b0         process as if %MIA0B0 appears in input file
-mp_mia1b0         process as if %MIA1B0 appears in input file
-mp_mia0b1         process as if %MIA0B1 appears in input file
-mp_mia1b1         process as if %MIA1B1 appears in input file
-mp_asaxby         process as if %ASAXBY appears in input file
-mp_asaybx         process as if %ASAYBX appears in input file