Artwork has been writing tools for processing RS274X files for over 25 years. During that time we have come across many files that are extremely large and difficult to process - sometimes the reason these files are so large and difficult is because they are written out poorly by the layout software that produced them.
Over the years then, we wrote many routines to detect these issues and to "clean" them prior to passing the data to the program code that actually manipulates (converts or rasterizes) the data. Eventually we gathered the various pre-processing routines -- which had been distributed between various application programs -- into a single library that we now place in front of all of Artwork's Gerber related processors.
We are releasing this collection of cleaning and conditioning routines as a stand-alone executable called split274x. Both GUI and command line options are available. The library is also available to OEMs who wish to tightly integrate the pre-processor into their software.
While many users will want to use split274x in command line mode for batch or script based processing, some will prefer an interactive interface. GBRPREP64 provides that interface by collecting user input and then launching split274x.
If you offer photo mask or PCB services and you routinely accept Gerber data from your customers you might be interested. Especially if you have customers that send files that bog down your photo plotter.
Or you might be an equipment manufacturer -- say inspection -- and you need to import large Gerber files to generate the "golden" reference.
Below - a list of issues that are addressed during the cleaning process:
Dynamic Range - Format Statement
We don't know about other software developers but our tools use 4 byte signed integers in our internal database to represent coordinates. This limits the dynamic range, though not for most practical purposes. Sometimes we encounter RS274X files with a combination of units/format that imply an impossibly high dynamic range; for example, a file in MM with format 5.6. It's unlikely that the data/application requires a range from 0.000001 mm to 99999.999999 mm; so the preprocessor needs to figure out where the data is located and re-adjust the format and coordinates to something reasonable - say 3.5.
Arc definitions can also go out of range for extremely "flat" arcs. These are detected and corrected.
Redefined Apertures Mid Stream
While it is "technically" legal to redefine an aperture in the middle of a stream of draw/flash commands we have found that many programs downstream don't support this behavior. The pre-processsor looks for this behavior and generates a unique aperture, removing the redefined aperture definition.
Redundant Aperture Definitions
We see many files with a large number of apertures; many of the apertures are either identical or so close in size as to be considered identical. This routine consolidates the definitions and adjusts the draw/flash d-code references appropriately.
This comparison and reduction is also performed on custom aperture macros. We find many files where the same aperture macro has been used for multiple d-code positions. See the example.
Remap Out-of-Range D-Codes
For some unknown reason, we encounter 274x files with d-codes as high as 50000. This is not necessary as there are very large gaps in the assigned d-codes. The program can be instructed to "remap" all d-codes above a user defined limit to available slots below the limit.
Very helpful when your Gerber editor or processor tops out a D999 and you encounter a file with D2050.
Filter Closely Spaced Vertices
Some software tools write out draws or G36/G37 polygons and place either zero-spaced vertices in the boundary or vertices so closely spaced as to have no effect other than to increase the data volume. These will be filtered out.
Break High Vertex Count Polygons
We have routinely run across Gerber files using G36/G37 area fill with polygons that have more than 250,000 vertices. This many vertices can overflow the buffers on many rasterizers - the data either gets dropped or the rasterizers completely bogs down. This function will break such polygons down to a number of smaller (butting) polygons that do not exceed a user defined vertex limit.
This applies to regions that contain arcs and segments. Each arc is examined and its potential vertex count is computed by assuming that it will be broken up downstream using the parameter we call chord error.
Redundant Layer Directives
Some problematic files make excessive use of LPD/LPC layers. (layer polarity clear/layer polarity dark) If the program finds that these directives actually do nothing it removes them. (such layers, even if empty, can use up program resources better allocated for other purposes.)
Redundant SR Directives
the SR command (step and repeat) is very effective it keeping data size down. However if used incorrectly or unnecessarily it can use up program resources. Split274x looks for redundant SR commands and removes them.
Fix Poorly Defined Arcs
Some PCB apps are producing files with poorly defined arcs (G02/G03 command). That is, they fail to use the G74/G75 setting to define whether they are using 360° or 90° circular interpolation. The pre-processor figures out which interpolation is used and properly sets up the parameters.
Arc Recovery
Some PCB layout tools do not output arcs - instead they approximate arcs with a large number of short segments. This will greatly increase the file size without transmitting additional information. Arc recovery looks for a series of short segments, finds the arc that they form and replaces the segments with an arc.
Convert Circle/Rectangle Draws to Flashes
We've seen some very large files (in the GByte range) where a large number of circular pads were drawn instead of flashed. We've seen the same for rectangles. This routine recognizes drawn round and rectangular regions and converts them to flashes.
This routine can flash both Manhattan and rotated rectangles.Windows
64 bit Windows 7/8/10
Linux
64 bit Linux RHEL 5 or later