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    rewrite input_file to filename remapping decodes to a list of unique ones, 
                     but always keep 

-split:basename      split input_file into several files using basename as the root file name

-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)

-macro_info          print macro details (informational)

-opt_tool_cnt        keep outputs that manifest optimal tool counts (informational)

-comments            emit G04 comment records when optimizing dcode table

-arcres:R            use R degrees for segmenting large radius circular data (default 1)

-maxpts:N            limit max polygon vertex count to N (default 4096)

-fmt:NM              set format to be N.M

-fmt:auto            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

-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

-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

-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 the same if they are within 1/dpi;
                     if an integer "closeness" is measured in grid points corresponding to
                     the format statement.

-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

-sanity              skip sanity check to see if this is an RS274X file

-no_cache            do not cache sizing or window break results

-verbose[:N]         set verbosity level

-vertex_floor:N      cache sizing results for vertex counts > N

-debug               run in debug mode

-debug:poly          run in window break debug mode

July 2018 - Updated split274x

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

Circularization needs clarification

1. circularizing (not multi-threaded) - refer to (5.) for more information

2. 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; 
a. if it is intended to archive conditioned Gerber files for reuse at a later time, large polygon breaking should be enforced with -dpi:0 and -maxpts:4096 (any polygon over 5K vertices is considered to be "big" in GBRPLT.DLL), this 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. b. 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) strcpy(Split274xOutputFile,splitFile); else 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 outputs -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

417 Ingalls St. Unit C, Santa Cruz, CA 95060 831.426.6163 email: